from IPython import display
display.Image("https://coursereport-s3-production.global.ssl.fastly.net/uploads/school/logo/2/original/CMYK-Red_Small_GeneralAssembly-Cog__1_.png")
from IPython import display
display.Image("https://logo.stocklight.com/NASDAQ/WIX_original.png")
from IPython import display
display.Image("https://media2.vault.com/20642/goldmansachs_logo_2018.jpg")
from IPython import display
display.Image("https://ewscripps.brightspotcdn.com/dims4/default/8a37e6a/2147483647/strip/true/crop/2690x1513+0+135/resize/1280x720!/quality/90/?url=http%3A%2F%2Fewscripps-brightspot.s3.amazonaws.com%2Fb2%2F15%2F8e74683743db90685e003ba76b87%2Fscreen-shot-2021-01-08-at-12.45.29%20PM.png")
from IPython import display
display.Image("https://www.statisticbrain.com/wp-content/uploads/2015/06/etsy-company-website-statistics-e1473352717799.jpg")
from IPython import display
display.Image("https://ewscripps.brightspotcdn.com/dims4/default/8a37e6a/2147483647/strip/true/crop/2690x1513+0+135/resize/1280x720!/quality/90/?url=http%3A%2F%2Fewscripps-brightspot.s3.amazonaws.com%2Fb2%2F15%2F8e74683743db90685e003ba76b87%2Fscreen-shot-2021-01-08-at-12.45.29%20PM.png")
from IPython import display
display.Image("https://cdn1.parksmedia.wdprapps.disney.com/media/blog/wp-content/uploads/2017/08/askh4769895.png")
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style('whitegrid')
plt.style.use('fivethirtyeight')
%matplotlib inline
from datetime import datetime
company_list = ['WIX', 'GS', 'GM', 'ETSY']
company_name = ['Wix.com', 'Goldman Sachs', 'General Motors', 'Etsy']
WIX_daily = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
GS_daily = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GM_daily = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
ETSY_daily = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
main = pd.concat((WIX_daily, GS_daily, GM_daily, ETSY_daily), axis=0, keys=["WIX", "GS", "GM", "ETSY"])
main.head(5)
| Day | High | Low | Open | Close | Volume | Company Name | ||
|---|---|---|---|---|---|---|---|---|
| WIX | NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-01 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | |
| NaN | 2008-01-02 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | |
| NaN | 2008-01-03 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | |
| NaN | 2008-01-04 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
main.tail(5)
| Day | High | Low | Open | Close | Volume | Company Name | ||
|---|---|---|---|---|---|---|---|---|
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC |
main.dropna(inplace=True)
main
| Day | High | Low | Open | Close | Volume | Company Name | ||
|---|---|---|---|---|---|---|---|---|
| WIX | NaN | 2013-11-06 | 18.90 | 16.190 | 18.50 | 16.50 | 11105201.0 | WIX.COM LTD |
| NaN | 2013-11-07 | 16.86 | 16.450 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | |
| NaN | 2013-11-08 | 18.09 | 16.580 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | |
| NaN | 2013-11-11 | 18.77 | 17.400 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | |
| NaN | 2013-11-12 | 18.77 | 17.400 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC |
9391 rows × 7 columns
main.loc["WIX"].describe()
| High | Low | Open | Close | Volume | |
|---|---|---|---|---|---|
| count | 1883.000000 | 1883.000000 | 1883.000000 | 1883.000000 | 1.883000e+03 |
| mean | 91.069875 | 87.320781 | 89.204249 | 89.112459 | 5.151665e+05 |
| std | 82.623714 | 78.912446 | 80.831664 | 80.667843 | 5.371709e+05 |
| min | 15.440000 | 14.280000 | 14.700000 | 14.760000 | 1.967400e+04 |
| 25% | 23.885000 | 22.945000 | 23.465000 | 23.425000 | 2.171700e+05 |
| 50% | 67.600000 | 65.300000 | 66.150000 | 66.300000 | 3.967820e+05 |
| 75% | 122.345000 | 118.500000 | 120.550000 | 120.710000 | 6.367465e+05 |
| max | 362.070000 | 342.770000 | 354.550000 | 353.090000 | 1.110520e+07 |
main.loc["GS"].describe()
| High | Low | Open | Close | Volume | |
|---|---|---|---|---|---|
| count | 3357.000000 | 3357.000000 | 3357.000000 | 3357.000000 | 3.357000e+03 |
| mean | 179.367778 | 175.249858 | 177.318441 | 177.286883 | 6.185088e+06 |
| std | 48.240087 | 47.962639 | 48.089353 | 47.997391 | 7.316739e+06 |
| min | 54.540000 | 47.410000 | 54.000000 | 52.000000 | 4.677220e+05 |
| 25% | 152.600000 | 149.250000 | 150.950000 | 150.820000 | 2.611078e+06 |
| 50% | 175.060000 | 170.760000 | 172.840000 | 172.770000 | 3.729719e+06 |
| 75% | 208.260000 | 204.550000 | 206.700000 | 206.430000 | 6.651579e+06 |
| max | 356.850000 | 347.480000 | 351.120000 | 352.970000 | 1.145906e+08 |
main.loc["GM"].describe()
| High | Low | Open | Close | Volume | |
|---|---|---|---|---|---|
| count | 2629.000000 | 2629.000000 | 2629.000000 | 2629.000000 | 2.629000e+03 |
| mean | 33.983484 | 33.184502 | 33.607103 | 33.577840 | 1.416645e+07 |
| std | 6.873151 | 6.774744 | 6.829975 | 6.817516 | 1.180856e+07 |
| min | 18.560000 | 14.325000 | 16.340000 | 16.800000 | 2.757591e+06 |
| 25% | 30.240000 | 29.430000 | 29.820000 | 29.860000 | 9.060203e+06 |
| 50% | 34.640000 | 33.930000 | 34.330000 | 34.270000 | 1.201105e+07 |
| 75% | 37.400000 | 36.660000 | 37.090000 | 37.040000 | 1.629633e+07 |
| max | 63.440000 | 60.690000 | 61.860000 | 61.940000 | 4.580977e+08 |
main.loc["ETSY"].describe()
| High | Low | Open | Close | Volume | |
|---|---|---|---|---|---|
| count | 1522.000000 | 1522.000000 | 1522.000000 | 1522.000000 | 1.522000e+03 |
| mean | 50.391483 | 47.945766 | 49.196300 | 49.069622 | 2.496820e+06 |
| std | 53.884808 | 50.976792 | 52.494403 | 52.285085 | 2.288934e+06 |
| min | 6.830000 | 6.040000 | 6.370000 | 6.360000 | 1.899780e+05 |
| 25% | 13.920000 | 13.340000 | 13.645000 | 13.632500 | 1.223574e+06 |
| 50% | 30.020000 | 28.995000 | 29.505000 | 29.410000 | 1.974536e+06 |
| 75% | 60.700000 | 58.080000 | 59.577500 | 59.222500 | 3.028503e+06 |
| max | 251.860000 | 236.780000 | 243.500000 | 244.580000 | 2.670650e+07 |
main.loc["ETSY"].info()
<class 'pandas.core.frame.DataFrame'> Float64Index: 1522 entries, nan to nan Data columns (total 7 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 Day 1522 non-null datetime64[ns] 1 High 1522 non-null float64 2 Low 1522 non-null float64 3 Open 1522 non-null float64 4 Close 1522 non-null float64 5 Volume 1522 non-null float64 6 Company Name 1522 non-null object dtypes: datetime64[ns](1), float64(5), object(1) memory usage: 95.1+ KB
WIX_day = main.loc["WIX"]["Day"]
WIX_close = main.loc["WIX"]["Close"]
GS_day = main.loc["GS"]["Day"]
GS_close = main.loc["GS"]["Close"]
GM_day = main.loc["GM"]["Day"]
GM_close = main.loc["GM"]["Close"]
ETSY_day = main.loc["ETSY"]["Day"]
ETSY_close = main.loc["ETSY"]["Close"]
plt.plot(WIX_day, WIX_close, label="WIX", color="#54BECA", linestyle="--")
plt.plot(GS_day, GS_close, label="GS", color="#0B64DB", marker=".", linestyle="-")
plt.plot(GM_day, GM_close, label="GM", color="#DB2A0B", marker=".")
plt.plot(ETSY_day, ETSY_close, label="ETSY", color="#0BDB7C", marker=".")
plt.xlabel("Year")
plt.ylabel("Daily Closing Price ($USD)")
plt.title("Historical Daily Closing Prices")
plt.legend()
plt.show()
WIX_day = main.loc["WIX"]["Day"]
WIX_volume = main.loc["WIX"]["Volume"]
GS_day = main.loc["GS"]["Day"]
GS_volume = main.loc["GS"]["Volume"]
GM_day = main.loc["GM"]["Day"]
GM_volume = main.loc["GM"]["Volume"]
ETSY_day = main.loc["ETSY"]["Day"]
ETSY_volume = main.loc["ETSY"]["Volume"]
plt.plot(WIX_day, WIX_volume, label="WIX", color="#54BECA", linestyle="--")
plt.plot(GS_day, GS_volume, label="GS", color="#0B64DB", marker=".", linestyle="-")
plt.plot(GM_day, GM_volume, label="GM", color="#DB2A0B", marker=".")
plt.plot(ETSY_day, ETSY_volume, label="ETSY", color="#0BDB7C", marker=".")
plt.xlabel("Year")
plt.ylabel("Daily Volume (Bn)")
plt.title("Historical Daily Volume")
plt.legend()
plt.tight_layout()
plt.plot(WIX_day, WIX_volume, label="WIX", color="#54BECA", linestyle="--")
plt.xlabel("Year")
plt.ylabel("Daily Volume (Bn)")
plt.title("Historical Daily Volume")
plt.legend()
plt.tight_layout()
plt.plot(GS_day, GS_volume, label="GS", color="#0B64DB", marker=".", linestyle="-")
plt.xlabel("Year")
plt.ylabel("Daily Volume (Bn)")
plt.title("Historical Daily Volume")
plt.legend()
plt.tight_layout()
plt.plot(GM_day, GM_volume, label="GM", color="#DB2A0B", marker=".")
plt.xlabel("Year")
plt.ylabel("Daily Volume (Bn)")
plt.title("Historical Daily Volume")
plt.legend()
plt.tight_layout()
plt.plot(ETSY_day, ETSY_volume, label="ETSY", color="#0BDB7C", marker=".")
plt.xlabel("Year")
plt.ylabel("Daily Volume (Bn)")
plt.title("Historical Daily Volume")
plt.legend()
plt.tight_layout()
main['Close'].dropna()
main['Returns'] = main['Close'].pct_change()
main.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | Returns | ||
|---|---|---|---|---|---|---|---|---|---|
| WIX | NaN | 2013-11-07 | 16.86 | 16.450 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.09 | 16.580 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 | |
| NaN | 2013-11-11 | 18.77 | 17.400 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 | |
| NaN | 2013-11-12 | 18.77 | 17.400 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 | |
| NaN | 2013-11-13 | 17.50 | 16.750 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
9390 rows × 8 columns
WIX_returns = main.loc["WIX"]["Returns"]
GS_returns = main.loc["GS"]["Returns"]
GM_returns = main.loc["GM"]["Returns"]
ETSY_returns = main.loc["ETSY"]["Returns"]
sns.jointplot(WIX_returns, WIX_returns, kind="scatter", color='seagreen')
plt.show()
C:\Users\rubin\anaconda3\lib\site-packages\seaborn\_decorators.py:36: FutureWarning: Pass the following variables as keyword args: x, y. From version 0.12, the only valid positional argument will be `data`, and passing other arguments without an explicit keyword will result in an error or misinterpretation. warnings.warn(
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
GS_only = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GS_only.head(5)
GS_only.dropna()
GS_only["GS Daily Returns"] = GS_only["Close"].pct_change()
GS_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GS Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2008-01-02 | 215.05 | 206.60 | 214.80 | 215.05 | 9575516.0 | GOLDMAN SACHS GROUP INC | 0.014674 |
| NaN | 2008-01-03 | 209.04 | 204.14 | 208.92 | 207.60 | 7753580.0 | GOLDMAN SACHS GROUP INC | -0.034643 |
| NaN | 2008-01-04 | 204.00 | 198.29 | 201.00 | 204.84 | 10158880.0 | GOLDMAN SACHS GROUP INC | -0.013295 |
| NaN | 2008-01-07 | 200.25 | 189.99 | 200.23 | 199.93 | 16044348.0 | GOLDMAN SACHS GROUP INC | -0.023970 |
| NaN | 2008-01-08 | 199.50 | 189.00 | 195.81 | 194.73 | 13556192.0 | GOLDMAN SACHS GROUP INC | -0.026009 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 345.90 | 340.89 | 341.94 | 339.35 | 2171458.0 | GOLDMAN SACHS GROUP INC | 0.025691 |
| NaN | 2021-04-27 | 347.55 | 343.66 | 344.00 | 343.52 | 2088604.0 | GOLDMAN SACHS GROUP INC | 0.012288 |
| NaN | 2021-04-28 | 350.12 | 346.09 | 348.00 | 346.63 | 2140875.0 | GOLDMAN SACHS GROUP INC | 0.009053 |
| NaN | 2021-04-29 | 353.83 | 347.48 | 350.55 | 348.11 | 2584423.0 | GOLDMAN SACHS GROUP INC | 0.004270 |
| NaN | 2021-04-30 | 352.82 | 347.20 | 351.12 | 352.97 | 2101069.0 | GOLDMAN SACHS GROUP INC | 0.013961 |
3356 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
GS = GS_only["GS Daily Returns"]
g = sns.jointplot(x=WIX, y=GS, kind='reg', color='blue', height=8, space=0.005, ratio=2, marginal_kws={'color':'xkcd:blue'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
GM_only = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
GM_only.head(5)
GM_only.dropna()
GM_only["GM Daily Returns"] = GM_only["Close"].pct_change()
GM_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GM Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2010-11-19 | 34.50 | 33.1100 | 34.150 | 34.19 | 107863195.0 | GENERAL MOTORS CO | 0.036061 |
| NaN | 2010-11-22 | 34.48 | 33.8100 | 34.200 | 34.26 | 36657284.0 | GENERAL MOTORS CO | 0.002047 |
| NaN | 2010-11-23 | 33.99 | 33.1900 | 33.950 | 34.08 | 31205498.0 | GENERAL MOTORS CO | -0.005254 |
| NaN | 2010-11-24 | 33.80 | 33.2200 | 33.730 | 33.25 | 26147933.0 | GENERAL MOTORS CO | -0.024354 |
| NaN | 2010-11-26 | 33.81 | 33.2100 | 33.410 | 33.48 | 12301247.0 | GENERAL MOTORS CO | 0.006917 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 58.58 | 57.6599 | 57.860 | 57.53 | 11553944.0 | GENERAL MOTORS CO | 0.015355 |
| NaN | 2021-04-27 | 59.10 | 58.0200 | 58.265 | 58.21 | 9293520.0 | GENERAL MOTORS CO | 0.011820 |
| NaN | 2021-04-28 | 59.00 | 58.2700 | 59.000 | 58.97 | 10485206.0 | GENERAL MOTORS CO | 0.013056 |
| NaN | 2021-04-29 | 57.75 | 55.6900 | 57.740 | 58.55 | 21315630.0 | GENERAL MOTORS CO | -0.007122 |
| NaN | 2021-04-30 | 57.34 | 56.0900 | 56.180 | 56.57 | 15348269.0 | GENERAL MOTORS CO | -0.033817 |
2628 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
GM = GM_only["GM Daily Returns"]
g = sns.jointplot(x=WIX, y=GM, kind='reg', color='red', height=8, space=0.005, ratio=2, marginal_kws={'color':'xkcd:red'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
ETSY_only = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
ETSY_only.head(5)
ETSY_only.dropna()
ETSY_only["ETSY Daily Returns"] = ETSY_only["Close"].pct_change()
ETSY_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | ETSY Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | 30.30 | 26.510 | 29.77 | 30.00 | 3965469.0 | ETSY INC | 0.875000 |
| NaN | 2015-04-20 | 28.90 | 24.870 | 28.77 | 27.58 | 3076216.0 | ETSY INC | -0.080667 |
| NaN | 2015-04-21 | 26.04 | 24.560 | 24.97 | 24.90 | 2185407.0 | ETSY INC | -0.097172 |
| NaN | 2015-04-22 | 26.24 | 24.950 | 26.00 | 25.75 | 1442915.0 | ETSY INC | 0.034137 |
| NaN | 2015-04-23 | 25.74 | 24.080 | 24.93 | 25.12 | 1299238.0 | ETSY INC | -0.024466 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
1521 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
ETSY = ETSY_only["ETSY Daily Returns"]
g = sns.jointplot(x=WIX, y=ETSY, kind='reg', color='purple', height=8, space=0.005, ratio=2, marginal_kws={'color':'xkcd:purple'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
GS_only = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GS_only.head(5)
GS_only.dropna()
GS_only["GS Daily Returns"] = GS_only["Close"].pct_change()
GS_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GS Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2008-01-02 | 215.05 | 206.60 | 214.80 | 215.05 | 9575516.0 | GOLDMAN SACHS GROUP INC | 0.014674 |
| NaN | 2008-01-03 | 209.04 | 204.14 | 208.92 | 207.60 | 7753580.0 | GOLDMAN SACHS GROUP INC | -0.034643 |
| NaN | 2008-01-04 | 204.00 | 198.29 | 201.00 | 204.84 | 10158880.0 | GOLDMAN SACHS GROUP INC | -0.013295 |
| NaN | 2008-01-07 | 200.25 | 189.99 | 200.23 | 199.93 | 16044348.0 | GOLDMAN SACHS GROUP INC | -0.023970 |
| NaN | 2008-01-08 | 199.50 | 189.00 | 195.81 | 194.73 | 13556192.0 | GOLDMAN SACHS GROUP INC | -0.026009 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 345.90 | 340.89 | 341.94 | 339.35 | 2171458.0 | GOLDMAN SACHS GROUP INC | 0.025691 |
| NaN | 2021-04-27 | 347.55 | 343.66 | 344.00 | 343.52 | 2088604.0 | GOLDMAN SACHS GROUP INC | 0.012288 |
| NaN | 2021-04-28 | 350.12 | 346.09 | 348.00 | 346.63 | 2140875.0 | GOLDMAN SACHS GROUP INC | 0.009053 |
| NaN | 2021-04-29 | 353.83 | 347.48 | 350.55 | 348.11 | 2584423.0 | GOLDMAN SACHS GROUP INC | 0.004270 |
| NaN | 2021-04-30 | 352.82 | 347.20 | 351.12 | 352.97 | 2101069.0 | GOLDMAN SACHS GROUP INC | 0.013961 |
3356 rows × 8 columns
GM_only = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
GM_only.head(5)
GM_only.dropna()
GM_only["GM Daily Returns"] = GM_only["Close"].pct_change()
GM_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GM Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2010-11-19 | 34.50 | 33.1100 | 34.150 | 34.19 | 107863195.0 | GENERAL MOTORS CO | 0.036061 |
| NaN | 2010-11-22 | 34.48 | 33.8100 | 34.200 | 34.26 | 36657284.0 | GENERAL MOTORS CO | 0.002047 |
| NaN | 2010-11-23 | 33.99 | 33.1900 | 33.950 | 34.08 | 31205498.0 | GENERAL MOTORS CO | -0.005254 |
| NaN | 2010-11-24 | 33.80 | 33.2200 | 33.730 | 33.25 | 26147933.0 | GENERAL MOTORS CO | -0.024354 |
| NaN | 2010-11-26 | 33.81 | 33.2100 | 33.410 | 33.48 | 12301247.0 | GENERAL MOTORS CO | 0.006917 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 58.58 | 57.6599 | 57.860 | 57.53 | 11553944.0 | GENERAL MOTORS CO | 0.015355 |
| NaN | 2021-04-27 | 59.10 | 58.0200 | 58.265 | 58.21 | 9293520.0 | GENERAL MOTORS CO | 0.011820 |
| NaN | 2021-04-28 | 59.00 | 58.2700 | 59.000 | 58.97 | 10485206.0 | GENERAL MOTORS CO | 0.013056 |
| NaN | 2021-04-29 | 57.75 | 55.6900 | 57.740 | 58.55 | 21315630.0 | GENERAL MOTORS CO | -0.007122 |
| NaN | 2021-04-30 | 57.34 | 56.0900 | 56.180 | 56.57 | 15348269.0 | GENERAL MOTORS CO | -0.033817 |
2628 rows × 8 columns
GS = GS_only["GS Daily Returns"]
GM = GM_only["GM Daily Returns"]
g = sns.jointplot(x=GS, y=GM, kind='reg', color='orange', height=8, space=0.005, ratio=2, marginal_kws={'color':'xkcd:orange'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
GS_only = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GS_only.head(5)
GS_only.dropna()
GS_only["GS Daily Returns"] = GS_only["Close"].pct_change()
GS_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GS Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2008-01-02 | 215.05 | 206.60 | 214.80 | 215.05 | 9575516.0 | GOLDMAN SACHS GROUP INC | 0.014674 |
| NaN | 2008-01-03 | 209.04 | 204.14 | 208.92 | 207.60 | 7753580.0 | GOLDMAN SACHS GROUP INC | -0.034643 |
| NaN | 2008-01-04 | 204.00 | 198.29 | 201.00 | 204.84 | 10158880.0 | GOLDMAN SACHS GROUP INC | -0.013295 |
| NaN | 2008-01-07 | 200.25 | 189.99 | 200.23 | 199.93 | 16044348.0 | GOLDMAN SACHS GROUP INC | -0.023970 |
| NaN | 2008-01-08 | 199.50 | 189.00 | 195.81 | 194.73 | 13556192.0 | GOLDMAN SACHS GROUP INC | -0.026009 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 345.90 | 340.89 | 341.94 | 339.35 | 2171458.0 | GOLDMAN SACHS GROUP INC | 0.025691 |
| NaN | 2021-04-27 | 347.55 | 343.66 | 344.00 | 343.52 | 2088604.0 | GOLDMAN SACHS GROUP INC | 0.012288 |
| NaN | 2021-04-28 | 350.12 | 346.09 | 348.00 | 346.63 | 2140875.0 | GOLDMAN SACHS GROUP INC | 0.009053 |
| NaN | 2021-04-29 | 353.83 | 347.48 | 350.55 | 348.11 | 2584423.0 | GOLDMAN SACHS GROUP INC | 0.004270 |
| NaN | 2021-04-30 | 352.82 | 347.20 | 351.12 | 352.97 | 2101069.0 | GOLDMAN SACHS GROUP INC | 0.013961 |
3356 rows × 8 columns
ETSY_only = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
ETSY_only.head(5)
ETSY_only.dropna()
ETSY_only["ETSY Daily Returns"] = ETSY_only["Close"].pct_change()
ETSY_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | ETSY Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | 30.30 | 26.510 | 29.77 | 30.00 | 3965469.0 | ETSY INC | 0.875000 |
| NaN | 2015-04-20 | 28.90 | 24.870 | 28.77 | 27.58 | 3076216.0 | ETSY INC | -0.080667 |
| NaN | 2015-04-21 | 26.04 | 24.560 | 24.97 | 24.90 | 2185407.0 | ETSY INC | -0.097172 |
| NaN | 2015-04-22 | 26.24 | 24.950 | 26.00 | 25.75 | 1442915.0 | ETSY INC | 0.034137 |
| NaN | 2015-04-23 | 25.74 | 24.080 | 24.93 | 25.12 | 1299238.0 | ETSY INC | -0.024466 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
1521 rows × 8 columns
GS = GS_only["GS Daily Returns"]
ETSY = ETSY_only["ETSY Daily Returns"]
g = sns.jointplot(x=GS, y=ETSY, kind='reg', color='pink', height=8, space=0.005, ratio=2, marginal_kws={'color':'xkcd:pink'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
GM_only = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
GM_only.head(5)
GM_only.dropna()
GM_only["GM Daily Returns"] = GM_only["Close"].pct_change()
GM_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GM Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2010-11-19 | 34.50 | 33.1100 | 34.150 | 34.19 | 107863195.0 | GENERAL MOTORS CO | 0.036061 |
| NaN | 2010-11-22 | 34.48 | 33.8100 | 34.200 | 34.26 | 36657284.0 | GENERAL MOTORS CO | 0.002047 |
| NaN | 2010-11-23 | 33.99 | 33.1900 | 33.950 | 34.08 | 31205498.0 | GENERAL MOTORS CO | -0.005254 |
| NaN | 2010-11-24 | 33.80 | 33.2200 | 33.730 | 33.25 | 26147933.0 | GENERAL MOTORS CO | -0.024354 |
| NaN | 2010-11-26 | 33.81 | 33.2100 | 33.410 | 33.48 | 12301247.0 | GENERAL MOTORS CO | 0.006917 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 58.58 | 57.6599 | 57.860 | 57.53 | 11553944.0 | GENERAL MOTORS CO | 0.015355 |
| NaN | 2021-04-27 | 59.10 | 58.0200 | 58.265 | 58.21 | 9293520.0 | GENERAL MOTORS CO | 0.011820 |
| NaN | 2021-04-28 | 59.00 | 58.2700 | 59.000 | 58.97 | 10485206.0 | GENERAL MOTORS CO | 0.013056 |
| NaN | 2021-04-29 | 57.75 | 55.6900 | 57.740 | 58.55 | 21315630.0 | GENERAL MOTORS CO | -0.007122 |
| NaN | 2021-04-30 | 57.34 | 56.0900 | 56.180 | 56.57 | 15348269.0 | GENERAL MOTORS CO | -0.033817 |
2628 rows × 8 columns
ETSY_only = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
ETSY_only.head(5)
ETSY_only.dropna()
ETSY_only["ETSY Daily Returns"] = ETSY_only["Close"].pct_change()
ETSY_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | ETSY Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | 30.30 | 26.510 | 29.77 | 30.00 | 3965469.0 | ETSY INC | 0.875000 |
| NaN | 2015-04-20 | 28.90 | 24.870 | 28.77 | 27.58 | 3076216.0 | ETSY INC | -0.080667 |
| NaN | 2015-04-21 | 26.04 | 24.560 | 24.97 | 24.90 | 2185407.0 | ETSY INC | -0.097172 |
| NaN | 2015-04-22 | 26.24 | 24.950 | 26.00 | 25.75 | 1442915.0 | ETSY INC | 0.034137 |
| NaN | 2015-04-23 | 25.74 | 24.080 | 24.93 | 25.12 | 1299238.0 | ETSY INC | -0.024466 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
1521 rows × 8 columns
GM = GM_only["GM Daily Returns"]
ETSY = ETSY_only["ETSY Daily Returns"]
g = sns.jointplot(x=GM, y=ETSY, kind='reg', color='lightblue', height=8, space=0.002, ratio=2, marginal_kws={'color':'xkcd:lightblue'})
g.plot_joint(sns.kdeplot, color='grey', levels=5)
plt.tight_layout()
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
Days = WIX_only["Day"]
plt.plot(Days, WIX, label="WIX", color="#54BECA", marker=".", lw=0.5)
plt.xlabel("Day")
plt.ylabel("Wix.com Daily Price Returns (%)")
plt.title("Wix.com Daily Price Returns")
plt.legend()
plt.grid()
plt.show()
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
Days = WIX_only["Day"]
bins = [-0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3]
plt.hist(x=WIX, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("Wix.com Daily Price Returns Histogram")
plt.grid()
plt.show()
WIX_only = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
WIX_only.head(5)
WIX_only.dropna()
WIX_only["WIX Daily Returns"] = WIX_only["Close"].pct_change()
WIX_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | WIX Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2013-11-07 | 16.8600 | 16.45 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 |
| NaN | 2013-11-08 | 18.0900 | 16.58 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 |
| NaN | 2013-11-11 | 18.7700 | 17.40 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 |
| NaN | 2013-11-12 | 18.7700 | 17.40 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 |
| NaN | 2013-11-13 | 17.5000 | 16.75 | 17.48 | 17.55 | 365219.0 | WIX.COM LTD | -0.021739 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
1882 rows × 8 columns
WIX = WIX_only["WIX Daily Returns"]
Days = WIX_only["Day"]
bins = [-0.10, -0.09, -0.08, -0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
plt.hist(x=WIX, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("Wix.com Daily Price Returns Histogram")
plt.grid()
plt.show()
WIX.describe()
count 2732.000000 mean 0.001422 std 0.025780 min -0.217778 25% -0.005703 50% 0.000000 75% 0.008953 max 0.253252 Name: WIX Daily Returns, dtype: float64
GS_only = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GS_only.head(5)
GS_only.dropna()
GS_only["GS Daily Returns"] = GS_only["Close"].pct_change()
GS_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GS Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2008-01-02 | 215.05 | 206.60 | 214.80 | 215.05 | 9575516.0 | GOLDMAN SACHS GROUP INC | 0.014674 |
| NaN | 2008-01-03 | 209.04 | 204.14 | 208.92 | 207.60 | 7753580.0 | GOLDMAN SACHS GROUP INC | -0.034643 |
| NaN | 2008-01-04 | 204.00 | 198.29 | 201.00 | 204.84 | 10158880.0 | GOLDMAN SACHS GROUP INC | -0.013295 |
| NaN | 2008-01-07 | 200.25 | 189.99 | 200.23 | 199.93 | 16044348.0 | GOLDMAN SACHS GROUP INC | -0.023970 |
| NaN | 2008-01-08 | 199.50 | 189.00 | 195.81 | 194.73 | 13556192.0 | GOLDMAN SACHS GROUP INC | -0.026009 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 345.90 | 340.89 | 341.94 | 339.35 | 2171458.0 | GOLDMAN SACHS GROUP INC | 0.025691 |
| NaN | 2021-04-27 | 347.55 | 343.66 | 344.00 | 343.52 | 2088604.0 | GOLDMAN SACHS GROUP INC | 0.012288 |
| NaN | 2021-04-28 | 350.12 | 346.09 | 348.00 | 346.63 | 2140875.0 | GOLDMAN SACHS GROUP INC | 0.009053 |
| NaN | 2021-04-29 | 353.83 | 347.48 | 350.55 | 348.11 | 2584423.0 | GOLDMAN SACHS GROUP INC | 0.004270 |
| NaN | 2021-04-30 | 352.82 | 347.20 | 351.12 | 352.97 | 2101069.0 | GOLDMAN SACHS GROUP INC | 0.013961 |
3356 rows × 8 columns
GS = GS_only["GS Daily Returns"]
Days = GS_only["Day"]
plt.plot(Days, GS, label="GS", color="#0B3FDB", marker=".", lw=0.05)
plt.xlabel("Day")
plt.ylabel("Goldman Sachs Daily Price Returns (%)")
plt.title("Goldman Sachs Daily Price Returns")
plt.legend()
plt.grid()
plt.show()
GS_only = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GS_only.head(5)
GS_only.dropna()
GS_only["GS Daily Returns"] = GS_only["Close"].pct_change()
GS_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GS Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2008-01-02 | 215.05 | 206.60 | 214.80 | 215.05 | 9575516.0 | GOLDMAN SACHS GROUP INC | 0.014674 |
| NaN | 2008-01-03 | 209.04 | 204.14 | 208.92 | 207.60 | 7753580.0 | GOLDMAN SACHS GROUP INC | -0.034643 |
| NaN | 2008-01-04 | 204.00 | 198.29 | 201.00 | 204.84 | 10158880.0 | GOLDMAN SACHS GROUP INC | -0.013295 |
| NaN | 2008-01-07 | 200.25 | 189.99 | 200.23 | 199.93 | 16044348.0 | GOLDMAN SACHS GROUP INC | -0.023970 |
| NaN | 2008-01-08 | 199.50 | 189.00 | 195.81 | 194.73 | 13556192.0 | GOLDMAN SACHS GROUP INC | -0.026009 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 345.90 | 340.89 | 341.94 | 339.35 | 2171458.0 | GOLDMAN SACHS GROUP INC | 0.025691 |
| NaN | 2021-04-27 | 347.55 | 343.66 | 344.00 | 343.52 | 2088604.0 | GOLDMAN SACHS GROUP INC | 0.012288 |
| NaN | 2021-04-28 | 350.12 | 346.09 | 348.00 | 346.63 | 2140875.0 | GOLDMAN SACHS GROUP INC | 0.009053 |
| NaN | 2021-04-29 | 353.83 | 347.48 | 350.55 | 348.11 | 2584423.0 | GOLDMAN SACHS GROUP INC | 0.004270 |
| NaN | 2021-04-30 | 352.82 | 347.20 | 351.12 | 352.97 | 2101069.0 | GOLDMAN SACHS GROUP INC | 0.013961 |
3356 rows × 8 columns
GS = GS_only["GS Daily Returns"]
Days = GS_only["Day"]
bins = [-0.10, -0.09, -0.08, -0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
plt.hist(x=GS, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("Goldman Sachs Daily Price Returns Histogram")
plt.grid()
plt.show()
GS.describe()
count 4869.000000 mean 0.000306 std 0.020150 min -0.189596 25% -0.004691 50% 0.000000 75% 0.005423 max 0.264678 Name: GS Daily Returns, dtype: float64
GM_only = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
GM_only.head(5)
GM_only.dropna()
GM_only["GM Daily Returns"] = GM_only["Close"].pct_change()
GM_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GM Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2010-11-19 | 34.50 | 33.1100 | 34.150 | 34.19 | 107863195.0 | GENERAL MOTORS CO | 0.036061 |
| NaN | 2010-11-22 | 34.48 | 33.8100 | 34.200 | 34.26 | 36657284.0 | GENERAL MOTORS CO | 0.002047 |
| NaN | 2010-11-23 | 33.99 | 33.1900 | 33.950 | 34.08 | 31205498.0 | GENERAL MOTORS CO | -0.005254 |
| NaN | 2010-11-24 | 33.80 | 33.2200 | 33.730 | 33.25 | 26147933.0 | GENERAL MOTORS CO | -0.024354 |
| NaN | 2010-11-26 | 33.81 | 33.2100 | 33.410 | 33.48 | 12301247.0 | GENERAL MOTORS CO | 0.006917 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 58.58 | 57.6599 | 57.860 | 57.53 | 11553944.0 | GENERAL MOTORS CO | 0.015355 |
| NaN | 2021-04-27 | 59.10 | 58.0200 | 58.265 | 58.21 | 9293520.0 | GENERAL MOTORS CO | 0.011820 |
| NaN | 2021-04-28 | 59.00 | 58.2700 | 59.000 | 58.97 | 10485206.0 | GENERAL MOTORS CO | 0.013056 |
| NaN | 2021-04-29 | 57.75 | 55.6900 | 57.740 | 58.55 | 21315630.0 | GENERAL MOTORS CO | -0.007122 |
| NaN | 2021-04-30 | 57.34 | 56.0900 | 56.180 | 56.57 | 15348269.0 | GENERAL MOTORS CO | -0.033817 |
2628 rows × 8 columns
GM = GM_only["GM Daily Returns"]
Days = GM_only["Day"]
plt.plot(Days, GM, label="GM", color="#AE0BDB", marker=".", lw=0.05)
plt.xlabel("Day")
plt.ylabel("General Motors Daily Price Returns (%)")
plt.title("General Motors Daily Price Returns")
plt.legend()
plt.grid()
plt.show()
GM_only = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
GM_only.head(5)
GM_only.dropna()
GM_only["GM Daily Returns"] = GM_only["Close"].pct_change()
GM_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | GM Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2010-11-19 | 34.50 | 33.1100 | 34.150 | 34.19 | 107863195.0 | GENERAL MOTORS CO | 0.036061 |
| NaN | 2010-11-22 | 34.48 | 33.8100 | 34.200 | 34.26 | 36657284.0 | GENERAL MOTORS CO | 0.002047 |
| NaN | 2010-11-23 | 33.99 | 33.1900 | 33.950 | 34.08 | 31205498.0 | GENERAL MOTORS CO | -0.005254 |
| NaN | 2010-11-24 | 33.80 | 33.2200 | 33.730 | 33.25 | 26147933.0 | GENERAL MOTORS CO | -0.024354 |
| NaN | 2010-11-26 | 33.81 | 33.2100 | 33.410 | 33.48 | 12301247.0 | GENERAL MOTORS CO | 0.006917 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 58.58 | 57.6599 | 57.860 | 57.53 | 11553944.0 | GENERAL MOTORS CO | 0.015355 |
| NaN | 2021-04-27 | 59.10 | 58.0200 | 58.265 | 58.21 | 9293520.0 | GENERAL MOTORS CO | 0.011820 |
| NaN | 2021-04-28 | 59.00 | 58.2700 | 59.000 | 58.97 | 10485206.0 | GENERAL MOTORS CO | 0.013056 |
| NaN | 2021-04-29 | 57.75 | 55.6900 | 57.740 | 58.55 | 21315630.0 | GENERAL MOTORS CO | -0.007122 |
| NaN | 2021-04-30 | 57.34 | 56.0900 | 56.180 | 56.57 | 15348269.0 | GENERAL MOTORS CO | -0.033817 |
2628 rows × 8 columns
GM = GM_only["GM Daily Returns"]
Days = GM_only["Day"]
bins = [-0.10, -0.09, -0.08, -0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
plt.hist(x=GM, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("General Motors Daily Price Returns Histogram")
plt.grid()
plt.show()
GM.describe()
count 3816.000000 mean 0.000294 std 0.017481 min -0.173228 25% -0.004934 50% 0.000000 75% 0.005250 max 0.199432 Name: GM Daily Returns, dtype: float64
ETSY_only = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
ETSY_only.head(5)
ETSY_only.dropna()
ETSY_only["ETSY Daily Returns"] = ETSY_only["Close"].pct_change()
ETSY_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | ETSY Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | 30.30 | 26.510 | 29.77 | 30.00 | 3965469.0 | ETSY INC | 0.875000 |
| NaN | 2015-04-20 | 28.90 | 24.870 | 28.77 | 27.58 | 3076216.0 | ETSY INC | -0.080667 |
| NaN | 2015-04-21 | 26.04 | 24.560 | 24.97 | 24.90 | 2185407.0 | ETSY INC | -0.097172 |
| NaN | 2015-04-22 | 26.24 | 24.950 | 26.00 | 25.75 | 1442915.0 | ETSY INC | 0.034137 |
| NaN | 2015-04-23 | 25.74 | 24.080 | 24.93 | 25.12 | 1299238.0 | ETSY INC | -0.024466 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
1521 rows × 8 columns
ETSY = ETSY_only["ETSY Daily Returns"]
Days = ETSY_only["Day"]
plt.plot(Days, ETSY, label="ETSY", color="#0BDBD9", marker=".", lw=0.5)
plt.xlabel("Day")
plt.ylabel("Etsy Daily Price Returns (%)")
plt.title("Etsy Daily Price Returns")
plt.legend()
plt.grid()
plt.show()
ETSY_only = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
ETSY_only.head(5)
ETSY_only.dropna()
ETSY_only["ETSY Daily Returns"] = ETSY_only["Close"].pct_change()
ETSY_only.dropna()
| Day | High | Low | Open | Close | Volume | Company Name | ETSY Daily Returns | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | 30.30 | 26.510 | 29.77 | 30.00 | 3965469.0 | ETSY INC | 0.875000 |
| NaN | 2015-04-20 | 28.90 | 24.870 | 28.77 | 27.58 | 3076216.0 | ETSY INC | -0.080667 |
| NaN | 2015-04-21 | 26.04 | 24.560 | 24.97 | 24.90 | 2185407.0 | ETSY INC | -0.097172 |
| NaN | 2015-04-22 | 26.24 | 24.950 | 26.00 | 25.75 | 1442915.0 | ETSY INC | 0.034137 |
| NaN | 2015-04-23 | 25.74 | 24.080 | 24.93 | 25.12 | 1299238.0 | ETSY INC | -0.024466 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 |
1521 rows × 8 columns
ETSY = ETSY_only["ETSY Daily Returns"]
Days = ETSY_only["Day"]
bins = [-0.10, -0.09, -0.08, -0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
plt.hist(x=ETSY, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("Etsy Daily Price Returns Histogram")
plt.grid()
plt.show()
ETSY.describe()
count 2206.000000 mean 0.001770 std 0.036648 min -0.283411 25% -0.006874 50% 0.000000 75% 0.010861 max 0.875000 Name: ETSY Daily Returns, dtype: float64
WIX_daily = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
GS_daily = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GM_daily = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
ETSY_daily = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
WIX_daily
| Day | High | Low | Open | Close | Volume | Company Name | |
|---|---|---|---|---|---|---|---|
| NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-01 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-02 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-03 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-04 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD |
4870 rows × 7 columns
WIX_daily["Daily Price Return"] = WIX_daily["Close"].pct_change()
WIX_daily
| Day | High | Low | Open | Close | Volume | Company Name | Daily Price Return | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-01 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-02 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-03 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-04 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
4870 rows × 8 columns
WIX_daily.drop(['High'], axis=1, inplace=True)
WIX_daily.drop(['Low'], axis=1, inplace=True)
WIX_daily.drop(['Open'], axis=1, inplace=True)
WIX_daily.drop(['Volume'], axis=1, inplace=True)
WIX_daily.drop(['Company Name'], axis=1, inplace=True)
WIX_daily.drop(['Close'], axis=1, inplace=True)
WIX_daily.rename(columns = {'Daily Price Return':'WIX'}, inplace = True)
WIX_daily
| Day | WIX | |
|---|---|---|
| NaN | 2007-12-31 | NaN |
| NaN | 2008-01-01 | NaN |
| NaN | 2008-01-02 | NaN |
| NaN | 2008-01-03 | NaN |
| NaN | 2008-01-04 | NaN |
| ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 |
| NaN | 2021-04-27 | 0.043938 |
| NaN | 2021-04-28 | 0.002394 |
| NaN | 2021-04-29 | 0.045506 |
| NaN | 2021-04-30 | 0.000926 |
4870 rows × 2 columns
GS_daily["Daily Price Return"] = GS_daily["Close"].pct_change()
GS_daily.drop(['High'], axis=1, inplace=True)
GS_daily.drop(['Low'], axis=1, inplace=True)
GS_daily.drop(['Open'], axis=1, inplace=True)
GS_daily.drop(['Volume'], axis=1, inplace=True)
GS_daily.drop(['Company Name'], axis=1, inplace=True)
GS_daily.drop(['Close'], axis=1, inplace=True)
GS_daily.drop(['Day'], axis=1, inplace=True)
GS_daily.rename(columns = {'Daily Price Return':'GS'}, inplace = True)
GM_daily["Daily Price Return"] = GM_daily["Close"].pct_change()
GM_daily.drop(['High'], axis=1, inplace=True)
GM_daily.drop(['Low'], axis=1, inplace=True)
GM_daily.drop(['Open'], axis=1, inplace=True)
GM_daily.drop(['Volume'], axis=1, inplace=True)
GM_daily.drop(['Company Name'], axis=1, inplace=True)
GM_daily.drop(['Close'], axis=1, inplace=True)
GM_daily.drop(['Day'], axis=1, inplace=True)
GM_daily.rename(columns = {'Daily Price Return':'GM'}, inplace = True)
ETSY_daily["Daily Price Return"] = ETSY_daily["Close"].pct_change()
ETSY_daily.drop(['High'], axis=1, inplace=True)
ETSY_daily.drop(['Low'], axis=1, inplace=True)
ETSY_daily.drop(['Open'], axis=1, inplace=True)
ETSY_daily.drop(['Volume'], axis=1, inplace=True)
ETSY_daily.drop(['Company Name'], axis=1, inplace=True)
ETSY_daily.drop(['Close'], axis=1, inplace=True)
ETSY_daily.drop(['Day'], axis=1, inplace=True)
ETSY_daily.rename(columns = {'Daily Price Return':'ETSY'}, inplace = True)
daily_price_change = pd.concat([WIX_daily, GS_daily, GM_daily, ETSY_daily], axis=1, join="inner")
daily_price_change.dropna()
| Day | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2015-04-17 | -0.013976 | -0.004426 | 0.003790 | 0.875000 |
| NaN | 2015-04-18 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-19 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-20 | 0.000000 | -0.014285 | -0.011866 | -0.080667 |
| NaN | 2015-04-21 | 0.008798 | 0.003800 | 0.012828 | -0.097172 |
| ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 | 0.025691 | 0.015355 | 0.020496 |
| NaN | 2021-04-27 | 0.043938 | 0.012288 | 0.011820 | -0.043851 |
| NaN | 2021-04-28 | 0.002394 | 0.009053 | 0.013056 | 0.011258 |
| NaN | 2021-04-29 | 0.045506 | 0.004270 | -0.007122 | 0.018603 |
| NaN | 2021-04-30 | 0.000926 | 0.013961 | -0.033817 | -0.012065 |
2206 rows × 5 columns
daily_price_change_corr = daily_price_change.corr()
daily_price_change_corr
| WIX | GS | GM | ETSY | |
|---|---|---|---|---|
| WIX | 1.000000 | 0.306989 | 0.270180 | 0.319368 |
| GS | 0.306989 | 1.000000 | 0.591511 | 0.199689 |
| GM | 0.270180 | 0.591511 | 1.000000 | 0.163441 |
| ETSY | 0.319368 | 0.199689 | 0.163441 | 1.000000 |
plt.figure(figsize=(16, 6))
heatmap = sns.heatmap(daily_price_change_corr, vmin=-1, vmax=1, annot=True, cmap='BrBG')
heatmap.set_title('Daily Price Change Correlation Heatmap', fontdict={'fontsize':18}, pad=12)
Text(0.5, 1.0, 'Daily Price Change Correlation Heatmap')
daily_price_change.drop(['Day'], axis=1, inplace=True)
returns = daily_price_change.dropna()
area = np.pi * 20
plt.figure(figsize=(10, 7))
plt.scatter(returns.mean(), returns.std(), s=area)
plt.xlabel('Expected Return')
plt.ylabel('Risk')
plt.grid()
plt.title("Daily Expected Return vs. Risk of Each of WIX, GS, GM, and ETSY")
for label, x, y in zip(returns.columns, returns.mean(), returns.std()):
plt.annotate(label, xy=(x, y), xytext=(50, 50), textcoords='offset points', ha='right', va='bottom',
arrowprops=dict(arrowstyle='-', color='blue', connectionstyle='arc3,rad=-0.3'))
main["Rolling 50D Average Daily Returns"] = main["Returns"].rolling(50).mean()
main["Rolling 100D Average Daily Returns"] = main["Returns"].rolling(100).mean()
main["Rolling 200D Average Daily Returns"] = main["Returns"].rolling(200).mean()
main.tail(5)
| Day | High | Low | Open | Close | Volume | Company Name | Returns | Rolling 50D Average Daily Returns | Rolling 100D Average Daily Returns | Rolling 200D Average Daily Returns | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 | -0.000019 | 0.003703 | 0.004072 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 | -0.000932 | 0.003255 | 0.003736 | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 | -0.001397 | 0.003743 | 0.003933 | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 | -0.000552 | 0.003932 | 0.004328 | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 | -0.000275 | 0.003804 | 0.004307 |
WIX_day = main.loc["WIX"]["Day"]
WIX_50D = main.loc["WIX"]["Rolling 50D Average Daily Returns"]
WIX_100D = main.loc["WIX"]["Rolling 100D Average Daily Returns"]
WIX_200D = main.loc["WIX"]["Rolling 200D Average Daily Returns"]
plt.plot(WIX_day, WIX_50D, label="50D MA", color="#0B20DB",lw=2)
plt.plot(WIX_day, WIX_100D, label="100D MA", color="#54BECA", lw=2, linestyle="--")
plt.plot(WIX_day, WIX_200D, label="200D MA", color="#DB2A0B", lw=2)
plt.xlabel("Day")
plt.ylabel("Wix.com Rolling Average Returns")
plt.title("Wix.com Moving Average Daily Returns")
plt.legend()
plt.show()
main["Golden Cross"] = main["Rolling 50D Average Daily Returns"] - main["Rolling 200D Average Daily Returns"]
main.tail(5)
| Day | High | Low | Open | Close | Volume | Company Name | Returns | Rolling 50D Average Daily Returns | Rolling 100D Average Daily Returns | Rolling 200D Average Daily Returns | Golden Cross | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 | -0.000019 | 0.003703 | 0.004072 | -0.004091 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 | -0.000932 | 0.003255 | 0.003736 | -0.004667 | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 | -0.001397 | 0.003743 | 0.003933 | -0.005330 | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 | -0.000552 | 0.003932 | 0.004328 | -0.004879 | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 | -0.000275 | 0.003804 | 0.004307 | -0.004582 |
WIX_day = main.loc["WIX"]["Day"]
WIX_GC = main.loc["WIX"]["Golden Cross"]
def GC():
if WIX_GC.all() > 0:
return True
else:
return False
def GC2():
if WIX_GC.all() > 0:
return 1
else:
return 0
main["GC?"] = GC()
main["GC2?"] = GC2()
main["Golden Cross True"] = main["GC2?"] * main["Golden Cross"]
main
| Day | High | Low | Open | Close | Volume | Company Name | Returns | Rolling 50D Average Daily Returns | Rolling 100D Average Daily Returns | Rolling 200D Average Daily Returns | Golden Cross | GC? | GC2? | Golden Cross True | ||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| WIX | NaN | 2013-11-06 | 18.90 | 16.190 | 18.50 | 16.50 | 11105201.0 | WIX.COM LTD | NaN | NaN | NaN | NaN | NaN | True | 1 | NaN |
| NaN | 2013-11-07 | 16.86 | 16.450 | 16.64 | 16.31 | 587420.0 | WIX.COM LTD | -0.011515 | NaN | NaN | NaN | NaN | True | 1 | NaN | |
| NaN | 2013-11-08 | 18.09 | 16.580 | 16.59 | 16.56 | 526734.0 | WIX.COM LTD | 0.015328 | NaN | NaN | NaN | NaN | True | 1 | NaN | |
| NaN | 2013-11-11 | 18.77 | 17.400 | 17.68 | 17.30 | 437292.0 | WIX.COM LTD | 0.044686 | NaN | NaN | NaN | NaN | True | 1 | NaN | |
| NaN | 2013-11-12 | 18.77 | 17.400 | 18.77 | 17.94 | 155216.0 | WIX.COM LTD | 0.036994 | NaN | NaN | NaN | NaN | True | 1 | NaN | |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| ETSY | NaN | 2021-04-26 | 212.00 | 203.800 | 211.00 | 214.59 | 4198922.0 | ETSY INC | 0.020496 | -0.000019 | 0.003703 | 0.004072 | -0.004091 | True | 1 | -0.004091 |
| NaN | 2021-04-27 | 210.80 | 206.000 | 206.16 | 205.18 | 2288762.0 | ETSY INC | -0.043851 | -0.000932 | 0.003255 | 0.003736 | -0.004667 | True | 1 | -0.004667 | |
| NaN | 2021-04-28 | 212.97 | 202.500 | 206.26 | 207.49 | 1898706.0 | ETSY INC | 0.011258 | -0.001397 | 0.003743 | 0.003933 | -0.005330 | True | 1 | -0.005330 | |
| NaN | 2021-04-29 | 212.34 | 201.801 | 212.28 | 211.35 | 2316824.0 | ETSY INC | 0.018603 | -0.000552 | 0.003932 | 0.004328 | -0.004879 | True | 1 | -0.004879 | |
| NaN | 2021-04-30 | 207.95 | 198.080 | 206.34 | 208.80 | 3159133.0 | ETSY INC | -0.012065 | -0.000275 | 0.003804 | 0.004307 | -0.004582 | True | 1 | -0.004582 |
9391 rows × 15 columns
WIX_day = main.loc["WIX"]["Day"]
WIX_GC = main.loc["WIX"]["Golden Cross"]
WIX_GC4 = main.loc["WIX"]["Golden Cross True"]
plt.plot(WIX_day, WIX_GC, label="50D MA less 200D MA", color="#EED218",lw=2)
plt.xlabel("Day")
plt.ylabel("50D MA Daily Returns less 200D MA Daily Returns")
plt.title("Wix.com Golden Cross Periods")
plt.fill_between(WIX_day, WIX_GC, where=(WIX_GC4 > 0), facecolor="green", alpha=0.4, label="Golden Cross Periods")
plt.legend()
plt.show()
GS_day = main.loc["GS"]["Day"]
GS_50D = main.loc["GS"]["Rolling 50D Average Daily Returns"]
GS_100D = main.loc["GS"]["Rolling 100D Average Daily Returns"]
GS_200D = main.loc["GS"]["Rolling 200D Average Daily Returns"]
plt.plot(GS_day, GS_50D, label="50D MA", color="#9E2310",lw=2)
plt.plot(GS_day, GS_100D, label="100D MA", color="#52F1F0", lw=2, linestyle="--")
plt.plot(GS_day, GS_200D, label="200D MA", color="#900699", lw=2)
plt.xlabel("Day")
plt.ylabel("Goldman Sachs Rolling Average Returns")
plt.title("Goldman Sachs Moving Average Daily Returns")
plt.legend()
plt.show()
GS_day = main.loc["GS"]["Day"]
GS_GC = main.loc["GS"]["Golden Cross"]
GS_GC4 = main.loc["GS"]["Golden Cross True"]
plt.plot(GS_day, GS_GC, label="50D MA less 200D MA", color="#EED218",lw=2)
plt.xlabel("Day")
plt.ylabel("50D MA Daily Returns less 200D MA Daily Returns")
plt.title("Goldman Sachs Golden Cross Periods")
plt.fill_between(GS_day, GS_GC, where=(GS_GC4 > 0), facecolor="green", alpha=0.4, label="Golden Cross Periods")
plt.legend()
plt.show()
GM_day = main.loc["GM"]["Day"]
GM_50D = main.loc["GM"]["Rolling 50D Average Daily Returns"]
GM_100D = main.loc["GM"]["Rolling 100D Average Daily Returns"]
GM_200D = main.loc["GM"]["Rolling 200D Average Daily Returns"]
plt.plot(GM_day, GM_50D, label="50D MA", color="#5877F4",lw=2)
plt.plot(GM_day, GM_100D, label="100D MA", color="#73F458", lw=2, linestyle="--")
plt.plot(GM_day, GM_200D, label="200D MA", color="#E3F458", lw=2)
plt.xlabel("Day")
plt.ylabel("General Motors Rolling Average Returns")
plt.title("General Motors Moving Average Daily Returns")
plt.legend()
plt.show()
GM_day = main.loc["GM"]["Day"]
GM_GC = main.loc["GM"]["Golden Cross"]
GM_GC4 = main.loc["GM"]["Golden Cross True"]
plt.plot(GM_day, GM_GC, label="50D MA less 200D MA", color="#EED218",lw=2)
plt.xlabel("Day")
plt.ylabel("50D MA Daily Returns less 200D MA Daily Returns")
plt.title("General Motors Golden Cross Periods")
plt.fill_between(GM_day, GM_GC, where=(GM_GC4 > 0), facecolor="green", alpha=0.4, label="Golden Cross Periods")
plt.legend()
plt.show()
ETSY_day = main.loc["ETSY"]["Day"]
ETSY_50D = main.loc["ETSY"]["Rolling 50D Average Daily Returns"]
ETSY_100D = main.loc["ETSY"]["Rolling 100D Average Daily Returns"]
ETSY_200D = main.loc["ETSY"]["Rolling 200D Average Daily Returns"]
plt.plot(ETSY_day, ETSY_50D, label="50D MA", color="#6DF7F6",lw=2)
plt.plot(ETSY_day, ETSY_100D, label="100D MA", color="#010E0E", lw=2, linestyle="--")
plt.plot(ETSY_day, ETSY_200D, label="200D MA", color="#4F0A7F", lw=2)
plt.xlabel("Day")
plt.ylabel("Etsy Rolling Average Returns")
plt.title("Etsy Moving Average Daily Returns")
plt.legend()
plt.show()
ETSY_day = main.loc["ETSY"]["Day"]
ETSY_GC = main.loc["ETSY"]["Golden Cross"]
ETSY_GC4 = main.loc["ETSY"]["Golden Cross True"]
plt.plot(ETSY_day, ETSY_GC, label="50D MA less 200D MA", color="#EED218",lw=2)
plt.xlabel("Day")
plt.ylabel("50D MA Daily Returns less 200D MA Daily Returns")
plt.title("Etsy Golden Cross Periods")
plt.fill_between(ETSY_day, ETSY_GC, where=(ETSY_GC4 > 0), facecolor="green", alpha=0.4, label="Golden Cross Periods")
plt.legend()
plt.show()
WIX_annual = pd.read_excel('WIX Annual Data.xlsx', index_col=[0], header=1)
GS_annual = pd.read_excel('GS Annual Data.xlsx', index_col=[0], header=1)
GM_annual = pd.read_excel('GM Annual Data.xlsx', index_col=[0], header=1)
ETSY_annual = pd.read_excel('ETSY Annual Data.xlsx', index_col=[0], header=1)
WIX_annual
| Month | Trailing 12M Sales | Trailing 12M Operating Income | Operating Margin Growth | % of Shares Repurchased | FCF Yield | Trailing 12M Dividends per Share | |
|---|---|---|---|---|---|---|---|
| NaN | 2001-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2002-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2003-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2004-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2005-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2006-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2008-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2009-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2010-12-31 | NaN | NaN | NaN | NaN | NaN | NaN |
| NaN | 2011-12-31 | 24.600 | -22.443 | -0.912317 | NaN | NaN | 0.0 |
| NaN | 2012-12-31 | 43.676 | -15.035 | -0.344239 | NaN | NaN | 0.0 |
| NaN | 2013-12-31 | 80.473 | -26.590 | -0.330421 | NaN | NaN | 0.0 |
| NaN | 2014-12-31 | 141.841 | -55.644 | -0.392298 | NaN | -0.008093 | 0.0 |
| NaN | 2015-12-31 | 203.518 | -48.635 | -0.238971 | NaN | 0.015962 | 0.0 |
| NaN | 2016-12-31 | 290.103 | -44.032 | -0.151781 | NaN | 0.018875 | 0.0 |
| NaN | 2017-12-31 | 425.636 | -50.011 | -0.117497 | NaN | 0.026933 | 0.0 |
| NaN | 2018-12-31 | 603.704 | -30.630 | -0.050737 | NaN | 0.023470 | 0.0 |
| NaN | 2019-12-31 | 761.088 | -80.250 | -0.105441 | NaN | 0.020718 | 0.0 |
| NaN | 2020-12-31 | 988.760 | -197.342 | -0.199585 | NaN | 0.009593 | 0.0 |
WIX_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
WIX_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
WIX_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
WIX_annual.drop(['FCF Yield'], axis=1, inplace=True)
WIX_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GS_annual.drop(['Year'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GS_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
GS_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GS_annual.drop(['FCF Yield'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GM_annual.drop(['Year'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GM_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
GM_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GM_annual.drop(['FCF Yield'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
ETSY_annual.drop(['Year'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
ETSY_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
ETSY_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
ETSY_annual.drop(['FCF Yield'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
WIX_annual.rename(columns = {'Trailing 12M Sales':'WIX'}, inplace = True)
GS_annual.rename(columns = {'Trailing 12M Sales':'GS'}, inplace = True)
GM_annual.rename(columns = {'Trailing 12M Sales':'GM'}, inplace = True)
ETSY_annual.rename(columns = {'Trailing 12M Sales':'ETSY'}, inplace = True)
sales = pd.concat([WIX_annual, GS_annual, GM_annual, ETSY_annual], axis=1, join="inner")
sales
| Month | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2001-12-31 | NaN | 31138 | NaN | NaN |
| NaN | 2002-12-31 | NaN | 22854 | NaN | NaN |
| NaN | 2003-12-31 | NaN | 23623 | NaN | NaN |
| NaN | 2004-12-31 | NaN | 29839 | NaN | NaN |
| NaN | 2005-12-31 | NaN | 43391 | NaN | NaN |
| NaN | 2006-12-31 | NaN | 69353 | NaN | NaN |
| NaN | 2007-12-31 | NaN | 87968 | NaN | NaN |
| NaN | 2008-12-31 | NaN | 53579 | NaN | NaN |
| NaN | 2009-12-31 | NaN | 51673 | 104589.0 | NaN |
| NaN | 2010-12-31 | NaN | 45967 | 135592.0 | NaN |
| NaN | 2011-12-31 | 24.600 | 36793 | 150276.0 | NaN |
| NaN | 2012-12-31 | 43.676 | 41664 | 152256.0 | NaN |
| NaN | 2013-12-31 | 80.473 | 40874 | 155427.0 | 125.022 |
| NaN | 2014-12-31 | 141.841 | 40085 | 155929.0 | 195.591 |
| NaN | 2015-12-31 | 203.518 | 39208 | 152356.0 | 273.499 |
| NaN | 2016-12-31 | 290.103 | 37712 | 149184.0 | 364.967 |
| NaN | 2017-12-31 | 425.636 | 42533 | 145588.0 | 441.231 |
| NaN | 2018-12-31 | 603.704 | 52528 | 147049.0 | 603.693 |
| NaN | 2019-12-31 | 761.088 | 53922 | 137237.0 | 818.379 |
| NaN | 2020-12-31 | 988.760 | 53498 | 122485.0 | 1725.625 |
sales.rename(columns = {'Month':'Year'}, inplace = True)
sales.dropna()
| Year | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2013-12-31 | 80.473 | 40874 | 155427.0 | 125.022 |
| NaN | 2014-12-31 | 141.841 | 40085 | 155929.0 | 195.591 |
| NaN | 2015-12-31 | 203.518 | 39208 | 152356.0 | 273.499 |
| NaN | 2016-12-31 | 290.103 | 37712 | 149184.0 | 364.967 |
| NaN | 2017-12-31 | 425.636 | 42533 | 145588.0 | 441.231 |
| NaN | 2018-12-31 | 603.704 | 52528 | 147049.0 | 603.693 |
| NaN | 2019-12-31 | 761.088 | 53922 | 137237.0 | 818.379 |
| NaN | 2020-12-31 | 988.760 | 53498 | 122485.0 | 1725.625 |
WIX = sales['WIX']
GS = sales['GS']
GM = sales['GM']
ETSY = sales['ETSY']
dates = sales['Year']
ax = sns.lineplot(x=dates, y=GS, label="GS", palette="tab10", linewidth=4, markers=True)
sns.lineplot(x=dates, y=GM, label="GM", palette="tab10", linewidth=4, markers=True)
plt.title("Annual Sales of Goldman Sachs and General Motors in Millions ($USD)")
ax.set(xlabel="Year", ylabel="Sales in Millions of $ USD")
plt.show()
ax = sns.lineplot(x=dates, y=WIX, label="WIX", palette="tab10", linewidth=4, markers=True)
sns.lineplot(x=dates, y=ETSY, label="ETSY", palette="tab10", linewidth=4, markers=True)
plt.title("Annual Sales of Wix.com and Etsy in Millions ($USD)")
ax.set(xlabel="Year", ylabel="Sales in Millions of $ USD")
plt.show()
WIX_annual = pd.read_excel('WIX Annual Data.xlsx', index_col=[0], header=1)
GS_annual = pd.read_excel('GS Annual Data.xlsx', index_col=[0], header=1)
GM_annual = pd.read_excel('GM Annual Data.xlsx', index_col=[0], header=1)
ETSY_annual = pd.read_excel('ETSY Annual Data.xlsx', index_col=[0], header=1)
WIX_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
WIX_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
WIX_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
WIX_annual.drop(['FCF Yield'], axis=1, inplace=True)
WIX_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
GS_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GS_annual.drop(['FCF Yield'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GS_annual.drop(['Year'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
GM_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GM_annual.drop(['FCF Yield'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GM_annual.drop(['Year'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
ETSY_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
ETSY_annual.drop(['FCF Yield'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
ETSY_annual.drop(['Year'], axis=1, inplace=True)
WIX_annual
| Month | Operating Margin Growth | |
|---|---|---|
| NaN | 2001-12-31 | NaN |
| NaN | 2002-12-31 | NaN |
| NaN | 2003-12-31 | NaN |
| NaN | 2004-12-31 | NaN |
| NaN | 2005-12-31 | NaN |
| NaN | 2006-12-31 | NaN |
| NaN | 2007-12-31 | NaN |
| NaN | 2008-12-31 | NaN |
| NaN | 2009-12-31 | NaN |
| NaN | 2010-12-31 | NaN |
| NaN | 2011-12-31 | -0.912317 |
| NaN | 2012-12-31 | -0.344239 |
| NaN | 2013-12-31 | -0.330421 |
| NaN | 2014-12-31 | -0.392298 |
| NaN | 2015-12-31 | -0.238971 |
| NaN | 2016-12-31 | -0.151781 |
| NaN | 2017-12-31 | -0.117497 |
| NaN | 2018-12-31 | -0.050737 |
| NaN | 2019-12-31 | -0.105441 |
| NaN | 2020-12-31 | -0.199585 |
WIX_annual.rename(columns = {'Operating Margin Growth':'WIX'}, inplace = True)
WIX_annual.rename(columns = {'Month':'Year'}, inplace = True)
GS_annual.rename(columns = {'Operating Margin Growth':'GS'}, inplace = True)
GM_annual.rename(columns = {'Operating Margin Growth':'GM'}, inplace = True)
ETSY_annual.rename(columns = {'Operating Margin Growth':'ETSY'}, inplace = True)
operating_margin_growth = pd.concat([WIX_annual, GS_annual, GM_annual, ETSY_annual], axis=1, join="inner")
operating_margin_growth
| Year | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2001-12-31 | NaN | 0.118697 | NaN | NaN |
| NaN | 2002-12-31 | NaN | 0.142338 | NaN | NaN |
| NaN | 2003-12-31 | NaN | 0.188164 | NaN | NaN |
| NaN | 2004-12-31 | NaN | 0.223734 | NaN | NaN |
| NaN | 2005-12-31 | NaN | 0.190662 | NaN | NaN |
| NaN | 2006-12-31 | NaN | 0.209940 | NaN | NaN |
| NaN | 2007-12-31 | NaN | 0.197265 | NaN | NaN |
| NaN | 2008-12-31 | NaN | 0.043599 | NaN | NaN |
| NaN | 2009-12-31 | NaN | 0.383740 | -0.201006 | NaN |
| NaN | 2010-12-31 | NaN | 0.280462 | 0.037679 | NaN |
| NaN | 2011-12-31 | -0.912317 | 0.167668 | 0.037637 | NaN |
| NaN | 2012-12-31 | -0.344239 | 0.268985 | -0.199421 | NaN |
| NaN | 2013-12-31 | -0.330421 | 0.287151 | 0.033012 | 0.005863 |
| NaN | 2014-12-31 | -0.392298 | 0.308270 | 0.009812 | -0.031960 |
| NaN | 2015-12-31 | -0.238971 | 0.223883 | 0.032142 | -0.006889 |
| NaN | 2016-12-31 | -0.151781 | 0.273229 | 0.058223 | 0.048161 |
| NaN | 2017-12-31 | -0.117497 | 0.261726 | 0.059490 | 0.026961 |
| NaN | 2018-12-31 | -0.050737 | 0.237607 | 0.030228 | 0.123881 |
| NaN | 2019-12-31 | -0.105441 | 0.196265 | 0.039938 | 0.108460 |
| NaN | 2020-12-31 | -0.199585 | 0.233261 | 0.054162 | 0.245713 |
operating_margin_growth.dropna()
| Year | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2013-12-31 | -0.330421 | 0.287151 | 0.033012 | 0.005863 |
| NaN | 2014-12-31 | -0.392298 | 0.308270 | 0.009812 | -0.031960 |
| NaN | 2015-12-31 | -0.238971 | 0.223883 | 0.032142 | -0.006889 |
| NaN | 2016-12-31 | -0.151781 | 0.273229 | 0.058223 | 0.048161 |
| NaN | 2017-12-31 | -0.117497 | 0.261726 | 0.059490 | 0.026961 |
| NaN | 2018-12-31 | -0.050737 | 0.237607 | 0.030228 | 0.123881 |
| NaN | 2019-12-31 | -0.105441 | 0.196265 | 0.039938 | 0.108460 |
| NaN | 2020-12-31 | -0.199585 | 0.233261 | 0.054162 | 0.245713 |
sns.set_style('dark')
sns.scatterplot(x="Year", y="WIX", s=75, data=operating_margin_growth, label="WIX")
sns.scatterplot(x="Year", y="GS", marker="x", s=75, data=operating_margin_growth, label="GS")
sns.scatterplot(x="Year", y="GM", marker=">", s=75, data=operating_margin_growth, label="GM")
sns.scatterplot(x="Year", y="ETSY", marker="<", s=75, data=operating_margin_growth, label="ETSY")
plt.title("Annual Operating Margin % Change of Wix.com, Goldman Sachs, General Motors, and Etsy")
plt.ylabel("% Change in Operating Margin")
plt.grid()
plt.show()
WIX_annual = pd.read_excel('WIX Annual Data.xlsx', index_col=[0], header=1)
GS_annual = pd.read_excel('GS Annual Data.xlsx', index_col=[0], header=1)
GM_annual = pd.read_excel('GM Annual Data.xlsx', index_col=[0], header=1)
ETSY_annual = pd.read_excel('ETSY Annual Data.xlsx', index_col=[0], header=1)
WIX_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
WIX_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
WIX_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
WIX_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
WIX_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
GS_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GS_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
GS_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GS_annual.drop(['Year'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
GM_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
GM_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
GM_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
GM_annual.drop(['Year'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Operating Income'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Sales'], axis=1, inplace=True)
ETSY_annual.drop(['% of Shares Repurchased'], axis=1, inplace=True)
ETSY_annual.drop(['Operating Margin Growth'], axis=1, inplace=True)
ETSY_annual.drop(['Trailing 12M Dividends per Share'], axis=1, inplace=True)
ETSY_annual.drop(['Year'], axis=1, inplace=True)
WIX_annual
| Month | FCF Yield | |
|---|---|---|
| NaN | 2001-12-31 | NaN |
| NaN | 2002-12-31 | NaN |
| NaN | 2003-12-31 | NaN |
| NaN | 2004-12-31 | NaN |
| NaN | 2005-12-31 | NaN |
| NaN | 2006-12-31 | NaN |
| NaN | 2007-12-31 | NaN |
| NaN | 2008-12-31 | NaN |
| NaN | 2009-12-31 | NaN |
| NaN | 2010-12-31 | NaN |
| NaN | 2011-12-31 | NaN |
| NaN | 2012-12-31 | NaN |
| NaN | 2013-12-31 | NaN |
| NaN | 2014-12-31 | -0.008093 |
| NaN | 2015-12-31 | 0.015962 |
| NaN | 2016-12-31 | 0.018875 |
| NaN | 2017-12-31 | 0.026933 |
| NaN | 2018-12-31 | 0.023470 |
| NaN | 2019-12-31 | 0.020718 |
| NaN | 2020-12-31 | 0.009593 |
WIX_annual.rename(columns = {'FCF Yield':'WIX'}, inplace = True)
WIX_annual.rename(columns = {'Month':'Year'}, inplace = True)
WIX_annual
| Year | WIX | |
|---|---|---|
| NaN | 2001-12-31 | NaN |
| NaN | 2002-12-31 | NaN |
| NaN | 2003-12-31 | NaN |
| NaN | 2004-12-31 | NaN |
| NaN | 2005-12-31 | NaN |
| NaN | 2006-12-31 | NaN |
| NaN | 2007-12-31 | NaN |
| NaN | 2008-12-31 | NaN |
| NaN | 2009-12-31 | NaN |
| NaN | 2010-12-31 | NaN |
| NaN | 2011-12-31 | NaN |
| NaN | 2012-12-31 | NaN |
| NaN | 2013-12-31 | NaN |
| NaN | 2014-12-31 | -0.008093 |
| NaN | 2015-12-31 | 0.015962 |
| NaN | 2016-12-31 | 0.018875 |
| NaN | 2017-12-31 | 0.026933 |
| NaN | 2018-12-31 | 0.023470 |
| NaN | 2019-12-31 | 0.020718 |
| NaN | 2020-12-31 | 0.009593 |
GS_annual.rename(columns = {'FCF Yield':'GS'}, inplace = True)
GM_annual.rename(columns = {'FCF Yield':'GM'}, inplace = True)
ETSY_annual.rename(columns = {'FCF Yield':'ETSY'}, inplace = True)
free_cash_flow_yield = pd.concat([WIX_annual, GS_annual, GM_annual, ETSY_annual], axis=1, join="inner")
free_cash_flow_yield
| Year | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2001-12-31 | NaN | -0.349933 | NaN | NaN |
| NaN | 2002-12-31 | NaN | -0.063017 | NaN | NaN |
| NaN | 2003-12-31 | NaN | -0.368900 | NaN | NaN |
| NaN | 2004-12-31 | NaN | -0.670740 | NaN | NaN |
| NaN | 2005-12-31 | NaN | -0.223644 | NaN | NaN |
| NaN | 2006-12-31 | NaN | NaN | NaN | NaN |
| NaN | 2007-12-31 | NaN | -0.765440 | NaN | NaN |
| NaN | 2008-12-31 | NaN | -0.019309 | NaN | NaN |
| NaN | 2009-12-31 | NaN | 0.537026 | NaN | NaN |
| NaN | 2010-12-31 | NaN | -0.080144 | 0.046627 | NaN |
| NaN | 2011-12-31 | NaN | 0.456199 | 0.063149 | NaN |
| NaN | 2012-12-31 | NaN | 0.186258 | 0.055770 | NaN |
| NaN | 2013-12-31 | NaN | 0.046466 | 0.088786 | NaN |
| NaN | 2014-12-31 | -0.008093 | -0.095608 | 0.052920 | NaN |
| NaN | 2015-12-31 | 0.015962 | 0.050638 | 0.070797 | 0.016744 |
| NaN | 2016-12-31 | 0.018875 | 0.039558 | 0.152985 | -0.000090 |
| NaN | 2017-12-31 | 0.026933 | -0.204218 | 0.211796 | 0.022671 |
| NaN | 2018-12-31 | 0.023470 | 0.136005 | 0.076530 | 0.031211 |
| NaN | 2019-12-31 | 0.020718 | 0.231914 | 0.101880 | 0.036217 |
| NaN | 2020-12-31 | 0.009593 | -0.210118 | 0.190511 | 0.030914 |
free_cash_flow_yield.dropna()
| Year | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2015-12-31 | 0.015962 | 0.050638 | 0.070797 | 0.016744 |
| NaN | 2016-12-31 | 0.018875 | 0.039558 | 0.152985 | -0.000090 |
| NaN | 2017-12-31 | 0.026933 | -0.204218 | 0.211796 | 0.022671 |
| NaN | 2018-12-31 | 0.023470 | 0.136005 | 0.076530 | 0.031211 |
| NaN | 2019-12-31 | 0.020718 | 0.231914 | 0.101880 | 0.036217 |
| NaN | 2020-12-31 | 0.009593 | -0.210118 | 0.190511 | 0.030914 |
x = free_cash_flow_yield['Year']
y = free_cash_flow_yield['WIX']
plt.stem(x,y)
plt.title("Wix.com Annual Free Cash Flow Yield %")
plt.xlabel("Year")
plt.ylabel("Annual Free Cash Flow Yield %")
plt.grid()
plt.show()
free_cash_flow_yield['WIX'].describe()
count 7.000000 mean 0.015351 std 0.011722 min -0.008093 25% 0.012778 50% 0.018875 75% 0.022094 max 0.026933 Name: WIX, dtype: float64
x = free_cash_flow_yield['Year']
y = free_cash_flow_yield['GS']
plt.stem(x,y)
plt.title("Goldman Sachs Annual Free Cash Flow Yield %")
plt.xlabel("Year")
plt.ylabel("Annual Free Cash Flow Yield %")
plt.grid()
plt.show()
free_cash_flow_yield['GS'].describe()
count 19.000000 mean -0.071948 std 0.330112 min -0.765440 25% -0.216881 50% -0.063017 75% 0.093322 max 0.537026 Name: GS, dtype: float64
x = free_cash_flow_yield['Year']
y = free_cash_flow_yield['GM']
plt.stem(x,y)
plt.title("General Motors Annual Free Cash Flow Yield %")
plt.xlabel("Year")
plt.ylabel("Annual Free Cash Flow Yield %")
plt.grid()
plt.show()
free_cash_flow_yield['GM'].describe()
count 11.000000 mean 0.101068 std 0.057791 min 0.046627 25% 0.059459 50% 0.076530 75% 0.127433 max 0.211796 Name: GM, dtype: float64
x = free_cash_flow_yield['Year']
y = free_cash_flow_yield['ETSY']
plt.stem(x,y)
plt.title("Etsy Annual Free Cash Flow Yield %")
plt.xlabel("Year")
plt.ylabel("Annual Free Cash Flow Yield %")
plt.grid()
plt.show()
free_cash_flow_yield['ETSY'].describe()
count 6.000000 mean 0.022945 std 0.013245 min -0.000090 25% 0.018226 50% 0.026793 75% 0.031137 max 0.036217 Name: ETSY, dtype: float64
s = sales.corr()
s
| WIX | GS | GM | ETSY | |
|---|---|---|---|---|
| WIX | 1.000000 | 0.896485 | -0.911370 | 0.934319 |
| GS | 0.896485 | 1.000000 | -0.703649 | 0.767816 |
| GM | -0.911370 | -0.703649 | 1.000000 | -0.982358 |
| ETSY | 0.934319 | 0.767816 | -0.982358 | 1.000000 |
cmap=sns.diverging_palette(230, 20, as_cmap=True)
sns.heatmap(s, cmap=cmap, vmax=.3, center=0,
square=True, linewidths=.5, annot=True, cbar_kws={"shrink": .5})
plt.title("Trailing 12M Sales Correlation Matrix")
plt.show()
om = operating_margin_growth.corr()
om
| WIX | GS | GM | ETSY | |
|---|---|---|---|---|
| WIX | 1.000000 | 0.340954 | 0.137535 | 0.512967 |
| GS | 0.340954 | 1.000000 | -0.570735 | -0.553289 |
| GM | 0.137535 | -0.570735 | 1.000000 | 0.446745 |
| ETSY | 0.512967 | -0.553289 | 0.446745 | 1.000000 |
sns.heatmap(om, annot = True, vmin=-1, vmax=1, center= 0, cmap= 'coolwarm', linewidths=1, linecolor='black')
plt.title("Annual Operating Margin % Change Correlation Matrix")
plt.show()
fcf = free_cash_flow_yield.corr()
fcf
| WIX | GS | GM | ETSY | |
|---|---|---|---|---|
| WIX | 1.000000 | 0.303625 | 0.423155 | 0.010804 |
| GS | 0.303625 | 1.000000 | -0.534627 | 0.113985 |
| GM | 0.423155 | -0.534627 | 1.000000 | -0.130531 |
| ETSY | 0.010804 | 0.113985 | -0.130531 | 1.000000 |
sns.heatmap(fcf, annot = True,square=True, linewidths=1, linecolor="white")
plt.title("Annual Free Cash Flow Yield % Correlation Matrix")
plt.show()
from IPython import display
display.Image("https://static.wixstatic.com/media/984ed3_15f85800841b4077a9400a01c7754212~mv2.png/v1/fill/w_1000,h_571,al_c,usm_0.66_1.00_0.01/984ed3_15f85800841b4077a9400a01c7754212~mv2.png")
from IPython import display
display.Image("https://s.wsj.net/public/resources/images/BN-XW068_SOLOMO_GR_20180314141307.jpg")
from IPython import display
display.Image("https://cloudfront-us-east-2.images.arcpublishing.com/reuters/NCIL3MS2X5JFFNDJZWMVILOLM4.jpg")
from IPython import display
display.Image("https://www.telegraph.co.uk/content/dam/technology/2020/12/16/TELEMMGLPICT000146603421_trans_NvBQzQNjv4BqPWkZHkfGGZ82cA9C-lpKaSnW8BLq_9yFhLlXda78vfw.jpeg")
WIX_daily = pd.read_excel('WIX Daily Data.xlsx', index_col=[0], header=1)
GS_daily = pd.read_excel('GS Daily Data.xlsx', index_col=[0], header=1)
GM_daily = pd.read_excel('GM Daily Data.xlsx', index_col=[0], header=1)
ETSY_daily = pd.read_excel('ETSY Daily Data.xlsx', index_col=[0], header=1)
Weights = [0.35, 0.25, 0.20, 0.20]
Positions = ["WIX", "GS", "ETSY", "GM"]
explode = [0.1, 0.1, 0.1, 0.1]
plt.pie(Weights, labels=Positions, explode=explode, autopct="%1.0f%%")
plt.title("Proposed Portfolio of 4 Stocks")
plt.show()
WIX_daily
| Day | High | Low | Open | Close | Volume | Company Name | |
|---|---|---|---|---|---|---|---|
| NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-01 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-02 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-03 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| NaN | 2008-01-04 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD |
| ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD |
4870 rows × 7 columns
WIX_daily["Daily Price Return"] = WIX_daily["Close"].pct_change()
WIX_daily
| Day | High | Low | Open | Close | Volume | Company Name | Daily Price Return | |
|---|---|---|---|---|---|---|---|---|
| NaN | 2007-12-31 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-01 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-02 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-03 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| NaN | 2008-01-04 | NaN | NaN | NaN | NaN | NaN | WIX.COM LTD | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 309.7800 | 298.16 | 298.32 | 296.10 | 270975.0 | WIX.COM LTD | 0.000676 |
| NaN | 2021-04-27 | 318.7800 | 308.17 | 313.23 | 309.11 | 367253.0 | WIX.COM LTD | 0.043938 |
| NaN | 2021-04-28 | 324.5900 | 307.69 | 309.49 | 309.85 | 531213.0 | WIX.COM LTD | 0.002394 |
| NaN | 2021-04-29 | 328.9999 | 319.59 | 327.52 | 323.95 | 437431.0 | WIX.COM LTD | 0.045506 |
| NaN | 2021-04-30 | 326.2200 | 316.25 | 317.66 | 324.25 | 302646.0 | WIX.COM LTD | 0.000926 |
4870 rows × 8 columns
WIX_daily.drop(['High'], axis=1, inplace=True)
WIX_daily.drop(['Low'], axis=1, inplace=True)
WIX_daily.drop(['Open'], axis=1, inplace=True)
WIX_daily.drop(['Volume'], axis=1, inplace=True)
WIX_daily.drop(['Company Name'], axis=1, inplace=True)
WIX_daily.drop(['Close'], axis=1, inplace=True)
WIX_daily.rename(columns = {'Daily Price Return':'WIX'}, inplace = True)
WIX_daily
| Day | WIX | |
|---|---|---|
| NaN | 2007-12-31 | NaN |
| NaN | 2008-01-01 | NaN |
| NaN | 2008-01-02 | NaN |
| NaN | 2008-01-03 | NaN |
| NaN | 2008-01-04 | NaN |
| ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 |
| NaN | 2021-04-27 | 0.043938 |
| NaN | 2021-04-28 | 0.002394 |
| NaN | 2021-04-29 | 0.045506 |
| NaN | 2021-04-30 | 0.000926 |
4870 rows × 2 columns
GS_daily["Daily Price Return"] = GS_daily["Close"].pct_change()
GS_daily.drop(['High'], axis=1, inplace=True)
GS_daily.drop(['Low'], axis=1, inplace=True)
GS_daily.drop(['Open'], axis=1, inplace=True)
GS_daily.drop(['Volume'], axis=1, inplace=True)
GS_daily.drop(['Company Name'], axis=1, inplace=True)
GS_daily.drop(['Close'], axis=1, inplace=True)
GS_daily.drop(['Day'], axis=1, inplace=True)
GS_daily.rename(columns = {'Daily Price Return':'GS'}, inplace = True)
GS_daily
| GS | |
|---|---|
| NaN | NaN |
| NaN | 0.000000 |
| NaN | 0.014674 |
| NaN | -0.034643 |
| NaN | -0.013295 |
| ... | ... |
| NaN | 0.025691 |
| NaN | 0.012288 |
| NaN | 0.009053 |
| NaN | 0.004270 |
| NaN | 0.013961 |
4870 rows × 1 columns
GM_daily["Daily Price Return"] = GM_daily["Close"].pct_change()
GM_daily.drop(['High'], axis=1, inplace=True)
GM_daily.drop(['Low'], axis=1, inplace=True)
GM_daily.drop(['Open'], axis=1, inplace=True)
GM_daily.drop(['Volume'], axis=1, inplace=True)
GM_daily.drop(['Company Name'], axis=1, inplace=True)
GM_daily.drop(['Close'], axis=1, inplace=True)
GM_daily.drop(['Day'], axis=1, inplace=True)
GM_daily.rename(columns = {'Daily Price Return':'GM'}, inplace = True)
GM_daily
| GM | |
|---|---|
| NaN | NaN |
| NaN | NaN |
| NaN | NaN |
| NaN | NaN |
| NaN | NaN |
| ... | ... |
| NaN | 0.015355 |
| NaN | 0.011820 |
| NaN | 0.013056 |
| NaN | -0.007122 |
| NaN | -0.033817 |
4870 rows × 1 columns
ETSY_daily["Daily Price Return"] = ETSY_daily["Close"].pct_change()
ETSY_daily.drop(['High'], axis=1, inplace=True)
ETSY_daily.drop(['Low'], axis=1, inplace=True)
ETSY_daily.drop(['Open'], axis=1, inplace=True)
ETSY_daily.drop(['Volume'], axis=1, inplace=True)
ETSY_daily.drop(['Company Name'], axis=1, inplace=True)
ETSY_daily.drop(['Close'], axis=1, inplace=True)
ETSY_daily.drop(['Day'], axis=1, inplace=True)
ETSY_daily.rename(columns = {'Daily Price Return':'ETSY'}, inplace = True)
daily_price_change = pd.concat([WIX_daily, GS_daily, GM_daily, ETSY_daily], axis=1, join="inner")
daily_price_change.dropna()
| Day | WIX | GS | GM | ETSY | |
|---|---|---|---|---|---|
| NaN | 2015-04-17 | -0.013976 | -0.004426 | 0.003790 | 0.875000 |
| NaN | 2015-04-18 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-19 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-20 | 0.000000 | -0.014285 | -0.011866 | -0.080667 |
| NaN | 2015-04-21 | 0.008798 | 0.003800 | 0.012828 | -0.097172 |
| ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 | 0.025691 | 0.015355 | 0.020496 |
| NaN | 2021-04-27 | 0.043938 | 0.012288 | 0.011820 | -0.043851 |
| NaN | 2021-04-28 | 0.002394 | 0.009053 | 0.013056 | 0.011258 |
| NaN | 2021-04-29 | 0.045506 | 0.004270 | -0.007122 | 0.018603 |
| NaN | 2021-04-30 | 0.000926 | 0.013961 | -0.033817 | -0.012065 |
2206 rows × 5 columns
daily_price_change['WIX Weight'] = 0.35
daily_price_change['GS Weight'] = 0.25
daily_price_change['GM Weight'] = 0.20
daily_price_change['ETSY Weight'] = 0.20
daily_price_change.dropna()
| Day | WIX | GS | GM | ETSY | WIX Weight | GS Weight | GM Weight | ETSY Weight | |
|---|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | -0.013976 | -0.004426 | 0.003790 | 0.875000 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2015-04-18 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2015-04-19 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2015-04-20 | 0.000000 | -0.014285 | -0.011866 | -0.080667 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2015-04-21 | 0.008798 | 0.003800 | 0.012828 | -0.097172 | 0.35 | 0.25 | 0.2 | 0.2 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 | 0.025691 | 0.015355 | 0.020496 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2021-04-27 | 0.043938 | 0.012288 | 0.011820 | -0.043851 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2021-04-28 | 0.002394 | 0.009053 | 0.013056 | 0.011258 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2021-04-29 | 0.045506 | 0.004270 | -0.007122 | 0.018603 | 0.35 | 0.25 | 0.2 | 0.2 |
| NaN | 2021-04-30 | 0.000926 | 0.013961 | -0.033817 | -0.012065 | 0.35 | 0.25 | 0.2 | 0.2 |
2206 rows × 9 columns
daily_price_change['WIX Attribution'] = daily_price_change['WIX'] * daily_price_change['WIX Weight']
daily_price_change['GS Attribution'] = daily_price_change['GS'] * daily_price_change['GS Weight']
daily_price_change['GM Attribution'] = daily_price_change['GM'] * daily_price_change['GM Weight']
daily_price_change['ETSY Attribution'] = daily_price_change['ETSY'] * daily_price_change['ETSY Weight']
daily_price_change.dropna()
| Day | WIX | GS | GM | ETSY | WIX Weight | GS Weight | GM Weight | ETSY Weight | WIX Attribution | GS Attribution | GM Attribution | ETSY Attribution | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | -0.013976 | -0.004426 | 0.003790 | 0.875000 | 0.35 | 0.25 | 0.2 | 0.2 | -0.004892 | -0.001106 | 0.000758 | 0.175000 |
| NaN | 2015-04-18 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-19 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-20 | 0.000000 | -0.014285 | -0.011866 | -0.080667 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | -0.003571 | -0.002373 | -0.016133 |
| NaN | 2015-04-21 | 0.008798 | 0.003800 | 0.012828 | -0.097172 | 0.35 | 0.25 | 0.2 | 0.2 | 0.003079 | 0.000950 | 0.002566 | -0.019434 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 | 0.025691 | 0.015355 | 0.020496 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000237 | 0.006423 | 0.003071 | 0.004099 |
| NaN | 2021-04-27 | 0.043938 | 0.012288 | 0.011820 | -0.043851 | 0.35 | 0.25 | 0.2 | 0.2 | 0.015378 | 0.003072 | 0.002364 | -0.008770 |
| NaN | 2021-04-28 | 0.002394 | 0.009053 | 0.013056 | 0.011258 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000838 | 0.002263 | 0.002611 | 0.002252 |
| NaN | 2021-04-29 | 0.045506 | 0.004270 | -0.007122 | 0.018603 | 0.35 | 0.25 | 0.2 | 0.2 | 0.015927 | 0.001067 | -0.001424 | 0.003721 |
| NaN | 2021-04-30 | 0.000926 | 0.013961 | -0.033817 | -0.012065 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000324 | 0.003490 | -0.006763 | -0.002413 |
2206 rows × 13 columns
daily_price_change['Portfolio Return Based on Constant Weights'] = daily_price_change['WIX Attribution'] + daily_price_change['GS Attribution'] + daily_price_change['GM Attribution'] + daily_price_change['ETSY Attribution']
port_ret = daily_price_change['Portfolio Return Based on Constant Weights']
Days = daily_price_change['Day']
bins = [-0.10, -0.09, -0.08, -0.07, -0.06, -0.05, -0.04, -0.03, -0.02, -0.01, 0.00, 0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.10]
plt.hist(x=port_ret, bins=bins, edgecolor='black')
plt.xlabel("Returns")
plt.ylabel("Frequency")
plt.title("Portfolio Return Based on Constant Weights")
plt.grid()
plt.show()
daily_price_change.dropna()
| Day | WIX | GS | GM | ETSY | WIX Weight | GS Weight | GM Weight | ETSY Weight | WIX Attribution | GS Attribution | GM Attribution | ETSY Attribution | Portfolio Return Based on Constant Weights | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NaN | 2015-04-17 | -0.013976 | -0.004426 | 0.003790 | 0.875000 | 0.35 | 0.25 | 0.2 | 0.2 | -0.004892 | -0.001106 | 0.000758 | 0.175000 | 0.169760 |
| NaN | 2015-04-18 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-19 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | 0.000000 | 0.000000 | 0.000000 | 0.000000 |
| NaN | 2015-04-20 | 0.000000 | -0.014285 | -0.011866 | -0.080667 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000000 | -0.003571 | -0.002373 | -0.016133 | -0.022078 |
| NaN | 2015-04-21 | 0.008798 | 0.003800 | 0.012828 | -0.097172 | 0.35 | 0.25 | 0.2 | 0.2 | 0.003079 | 0.000950 | 0.002566 | -0.019434 | -0.012840 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| NaN | 2021-04-26 | 0.000676 | 0.025691 | 0.015355 | 0.020496 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000237 | 0.006423 | 0.003071 | 0.004099 | 0.013830 |
| NaN | 2021-04-27 | 0.043938 | 0.012288 | 0.011820 | -0.043851 | 0.35 | 0.25 | 0.2 | 0.2 | 0.015378 | 0.003072 | 0.002364 | -0.008770 | 0.012044 |
| NaN | 2021-04-28 | 0.002394 | 0.009053 | 0.013056 | 0.011258 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000838 | 0.002263 | 0.002611 | 0.002252 | 0.007964 |
| NaN | 2021-04-29 | 0.045506 | 0.004270 | -0.007122 | 0.018603 | 0.35 | 0.25 | 0.2 | 0.2 | 0.015927 | 0.001067 | -0.001424 | 0.003721 | 0.019291 |
| NaN | 2021-04-30 | 0.000926 | 0.013961 | -0.033817 | -0.012065 | 0.35 | 0.25 | 0.2 | 0.2 | 0.000324 | 0.003490 | -0.006763 | -0.002413 | -0.005362 |
2206 rows × 14 columns
daily_price_change.drop(['Day'], axis=1, inplace=True)
daily_price_change.drop(['WIX Weight'], axis=1, inplace=True)
daily_price_change.drop(['GS Weight'], axis=1, inplace=True)
daily_price_change.drop(['GM Weight'], axis=1, inplace=True)
daily_price_change.drop(['ETSY Weight'], axis=1, inplace=True)
daily_price_change.drop(['WIX Attribution'], axis=1, inplace=True)
daily_price_change.drop(['GS Attribution'], axis=1, inplace=True)
daily_price_change.drop(['GM Attribution'], axis=1, inplace=True)
daily_price_change.drop(['ETSY Attribution'], axis=1, inplace=True)
returns = daily_price_change.dropna()
area = np.pi * 20
plt.figure(figsize=(10, 7))
plt.scatter(returns.mean(), returns.std(), s=area)
plt.xlabel('Expected Return')
plt.ylabel('Risk')
plt.grid()
plt.title("Daily Expected Return vs. Risk of Each of Standalone Stocks and Proposed Constant Weight Portfolio")
for label, x, y in zip(returns.columns, returns.mean(), returns.std()):
plt.annotate(label, xy=(x, y), xytext=(50, 50), textcoords='offset points', ha='right', va='bottom',
arrowprops=dict(arrowstyle='-', color='blue', connectionstyle='arc3,rad=-0.3'))
from pandas_datareader.data import DataReader
df = DataReader('DIS', data_source='yahoo', start='2012-01-01', end='2021-10-31')
df
| High | Low | Open | Close | Volume | Adj Close | |
|---|---|---|---|---|---|---|
| Date | ||||||
| 2012-01-03 | 38.459999 | 37.939999 | 37.970001 | 38.310001 | 9704200.0 | 34.300621 |
| 2012-01-04 | 38.990002 | 38.119999 | 38.189999 | 38.849998 | 9889900.0 | 34.784107 |
| 2012-01-05 | 39.580002 | 38.700001 | 38.830002 | 39.500000 | 14327100.0 | 35.366081 |
| 2012-01-06 | 40.150002 | 39.450001 | 39.549999 | 39.910000 | 14401600.0 | 35.733166 |
| 2012-01-09 | 40.250000 | 39.590000 | 39.740002 | 39.750000 | 12145200.0 | 35.589909 |
| ... | ... | ... | ... | ... | ... | ... |
| 2021-10-25 | 172.570007 | 169.029999 | 169.899994 | 172.009995 | 9798700.0 | 172.009995 |
| 2021-10-26 | 173.119995 | 170.710007 | 172.949997 | 172.039993 | 5850200.0 | 172.039993 |
| 2021-10-27 | 172.039993 | 169.429993 | 171.770004 | 169.550003 | 7054700.0 | 169.550003 |
| 2021-10-28 | 170.350006 | 168.600006 | 169.479996 | 169.679993 | 7884500.0 | 169.679993 |
| 2021-10-29 | 170.460007 | 168.149994 | 169.020004 | 169.070007 | 7593400.0 | 169.070007 |
2474 rows × 6 columns
x = df.index
y2 = df['Close']
plt.figure(figsize=(16,6))
plt.plot(x, y2, label="Close", color="#0B64DB", marker=".", linestyle="-")
plt.title('Close Price History')
plt.xlabel('Date', fontsize=14)
plt.ylabel('Closing Price Price USD ($)', fontsize=14)
plt.title("Disney Historical Daily Closing Price", fontsize=24)
plt.grid()
plt.legend()
plt.show()
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, LSTM, Dropout
scaler = MinMaxScaler(feature_range=(0,1))
scaled_data = scaler.fit_transform(df['Close'].values.reshape(-1,1))
prediction_days = 100
#Defining two empty lists
x_train = []
y_train = []
#Start counting from the 100th index and go to the last index
#Loop through and add a value to x_train
#Through iterations, add 100 values and then the 101st data point will be the first training point
for x in range(prediction_days, len(scaled_data)):
#subtract prediction_days so we don't have any negative values
x_train.append(scaled_data[x-prediction_days:x, 0])
y_train.append(scaled_data[x, 0])
x_train, y_train = np.array(x_train), np.array(y_train)
x_train = np.reshape(x_train, (x_train.shape[0], x_train.shape[1],1))
#This is a basic neural network
model = Sequential()
#We can play with the units and number of layers to increase model prediction power, but want to be careful not to overfit
#return_sequence - LSTM is recurrent; it will feed back the information
model.add(LSTM(units=50, return_sequences=True, input_shape=(x_train.shape[1], 1)))
model.add(Dropout(0.2))
model.add(LSTM(units=50, return_sequences=True))
model.add(Dropout(0.2))
model.add(LSTM(units=50))
model.add(Dropout(0.2))
#The below code will be used to predict the next closing price
model.add(Dense(units=1))
model.compile(optimizer='adam', loss='mean_squared_error')
#The model will see the data 24 times; it will see 32 data points at once
model.fit(x_train, y_train, epochs=25, batch_size=32)
Epoch 1/25 68/68 [==============================] - 15s 125ms/step - loss: 0.0161 Epoch 2/25 68/68 [==============================] - 8s 118ms/step - loss: 0.0029 Epoch 3/25 68/68 [==============================] - 8s 116ms/step - loss: 0.0027 Epoch 4/25 68/68 [==============================] - 8s 112ms/step - loss: 0.0029 Epoch 5/25 68/68 [==============================] - 8s 115ms/step - loss: 0.0026 Epoch 6/25 68/68 [==============================] - 8s 111ms/step - loss: 0.0022 Epoch 7/25 68/68 [==============================] - 8s 118ms/step - loss: 0.0022 Epoch 8/25 68/68 [==============================] - 8s 113ms/step - loss: 0.0020 Epoch 9/25 68/68 [==============================] - 8s 119ms/step - loss: 0.0020 Epoch 10/25 68/68 [==============================] - 8s 112ms/step - loss: 0.0021 Epoch 11/25 68/68 [==============================] - 8s 116ms/step - loss: 0.0018 Epoch 12/25 68/68 [==============================] - 8s 113ms/step - loss: 0.0020 Epoch 13/25 68/68 [==============================] - 8s 114ms/step - loss: 0.0019 Epoch 14/25 68/68 [==============================] - 8s 124ms/step - loss: 0.0017 Epoch 15/25 68/68 [==============================] - 8s 115ms/step - loss: 0.0017 Epoch 16/25 68/68 [==============================] - 9s 137ms/step - loss: 0.0018 Epoch 17/25 68/68 [==============================] - 8s 116ms/step - loss: 0.0014 Epoch 18/25 68/68 [==============================] - 8s 111ms/step - loss: 0.0015 Epoch 19/25 68/68 [==============================] - 8s 115ms/step - loss: 0.0015 Epoch 20/25 68/68 [==============================] - 8s 112ms/step - loss: 0.0015 Epoch 21/25 68/68 [==============================] - 8s 113ms/step - loss: 0.0014 Epoch 22/25 68/68 [==============================] - 8s 118ms/step - loss: 0.0014 Epoch 23/25 68/68 [==============================] - 8s 115ms/step - loss: 0.0013 Epoch 24/25 68/68 [==============================] - 8s 116ms/step - loss: 0.0011 Epoch 25/25 68/68 [==============================] - 8s 113ms/step - loss: 0.0013
<tensorflow.python.keras.callbacks.History at 0x12162260b50>
import datetime as dt
import pandas_datareader as web
test_start = dt.datetime(2020,12,31)
test_end = dt.datetime.now()
company = "DIS"
test_data = web.DataReader(company, 'yahoo', test_start, test_end)
actual_prices = test_data['Close'].values
total_dataset = pd.concat((df['Close'], test_data['Close']), axis=0)
#this is what our model can see so it can predict the next price:
model_inputs = total_dataset[len(total_dataset) - len(test_data) - prediction_days:].values
#now let's reshape the model inputs
model_inputs = model_inputs.reshape(-1, 1)
model_inputs = scaler.transform(model_inputs)
x_test = []
for x in range(prediction_days, len(model_inputs)):
x_test.append(model_inputs[x-prediction_days:x, 0])
x_test = np.array(x_test)
x_test = np.reshape(x_test, (x_test.shape[0], x_test.shape[1], 1))
predicted_prices = model.predict(x_test)
#the predicted prices were scaled, so we need to reverse transform
predicted_prices = scaler.inverse_transform(predicted_prices)
plt.plot(actual_prices, color="blue", label=f"Actual {company} Price")
plt.plot(predicted_prices, color="green", label=f"Predicted {company} Price")
plt.title(f"{company} Share Price")
plt.xlabel("Time")
plt.ylabel(f"{company} Share Price")
plt.legend()
plt.grid()
plt.show()
real_data = [model_inputs[len(model_inputs) + 1 - prediction_days:len(model_inputs+1), 0]]
real_data = np.array(real_data)
real_data = np.reshape(real_data, (real_data.shape[0], real_data.shape[1], 1))
print(scaler.inverse_transform(real_data[-1]))
[[179.11999512] [178.58000183] [178.69000244] [179.08999634] [175.99000549] [176.11999512] [173.42999268] [171.44000244] [172.25999451] [173.63999939] [171.27999878] [172.77999878] [171.88999939] [169.55999756] [163.02999878] [171.88000488] [168.16999817] [170.97000122] [176.96000671] [176.42999268] [180.22999573] [181.16000366] [190. ] [188.21000671] [189.63000488] [190.91000366] [187.66999817] [186.3500061 ] [186.44000244] [183. ] [183.6499939 ] [191.75999451] [197.08999634] [197.50999451] [190.97999573] [189.03999329] [194.97999573] [193.94000244] [192.25999451] [188.02999878] [189.99000549] [201.91000366] [194.50999451] [195.05999756] [196.75 ] [197.16000366] [196.75999451] [194.24000549] [195.24000549] [192.27999878] [191.13999939] [192.86000061] [188.72999573] [184.72000122] [186.91000366] [185.91999817] [184.8500061 ] [185.52999878] [184.52000427] [188.97000122] [188.5 ] [189.72999573] [187.55999756] [187.32000732] [187.88999939] [186.49000549] [185.49000549] [187.46000671] [185.92999268] [187.25999451] [187.42999268] [182.78999329] [183.11000061] [182.75999451] [183.02000427] [184.27000427] [184.63999939] [183.38999939] [185.33000183] [186.02000427] [185.50999451] [184.25 ] [181.50999451] [181.78999329] [184.83999634] [184.30000305] [181.66999817] [177.8500061 ] [178.33999634] [173.69999695] [170.08000183] [169.67999268] [169.27000427] [171.36000061] [172.3999939 ] [174.30999756] [176.16999817] [176.47000122] [177.72000122]]
prediction = model.predict(real_data)
prediction = scaler.inverse_transform(prediction)
print(f"Next Day Price Prediction: {prediction}")
WARNING:tensorflow:Model was constructed with shape (None, 100, 1) for input KerasTensor(type_spec=TensorSpec(shape=(None, 100, 1), dtype=tf.float32, name='lstm_input'), name='lstm_input', description="created by layer 'lstm_input'"), but it was called on an input with incompatible shape (None, 99, 1). Next Day Price Prediction: [[167.04759]]